求hack
  • 板块学术版
  • 楼主shy_lihui
  • 当前回复5
  • 已保存回复5
  • 发布时间2024/11/4 18:44
  • 上次更新2024/11/4 19:24:11
查看原帖
求hack
1053122
shy_lihui楼主2024/11/4 18:44

rt.

题目意义就是今年CSP-J第三题 n20n \le20 的数据,但自此不知道为什么WA,附件可以AC

西西弗成绩也没拿到 n20n \le 20 的测试点

#include<bits/stdc++.h>

using namespace std;
int t,n;

int get(int x)
{
	if(x==0)
	{
		return 6;
	}
	if(x==1)
	{
		return 2;
	}
	if(x==2)
	{
		return 5;
	}
	if(x==3)
	{
		return 5;
	}
	if(x==4)
	{
		return 4;
	}
	if(x==5)
	{
		return 5;
	}
	if(x==6)
	{
		return 6;
	}
	if(x==7)
	{
		return 3;
	}
	if(x==8)
	{
		return 7;
	}
	if(x==9)
	{
		return 6;
	}
	return get(int(x/10))+get(x%10);
}
int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin>>t;
	while(t--)
	{
		cin>>n;
		if(n%7==0)
		{
			int k=n/7;
			while(k--)
			{
				cout<<8;
		 	}
		}
		else
		{
			if(n==1)
			{
				cout<<-1;
			}
			else
			{
				for(int i=0;;i++)
				{
					if(get(i)==n)
					{
						cout<<i;
						break;
					}
				}
			}
		}
	 	cout<<'\n';
	}		
	return 0;
}
2024/11/4 18:44
加载中...