UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#212693#3827. Awyc6326Compile Error//C++900b2024-10-20 09:44:522024-10-20 12:37:54

answer

#include<bits/stdc++.h>
using namespace std;

int trans1(int n)
{
	int ans=0,cur=1;
	while(n)
	{
		//305
		ans=ans+n%2*cur;
		n/=2;
		cur*=10;
	}
	string tmp=to_string(ans);
	return stoi(tmp);
}
int trans2(int n)
{
	int ans=0,cur=1;
	while(n)
	{
		//3
		ans=ans+n%3*cur;
		n/=3;
		cur*=10;
	}
	string tmp=to_string(ans);
	return stoi(tmp);
}
int main()
{
	//freopen("A.in","r",stdin);
	//freopen("A.out","w",stdout);
	int n;scanf("%d",&n);
	bool flag=0;
	int cnt=0;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
		{
			flag=1;
			//(i,j)
			int i2=trans1(i);
			int i3=trans2(i);
			int j2=trans1(j);
			int j3=trans2(j);
			for(char c:to_string(i2+j2)) //10+100
			{
				if(c-'0'>=2) flag=0;
			}
			for(char c:to_string(i3+j3)) //2+11
			{
				if(c-'0'>=3&&flag) flag=0;
			}
			if(flag) cnt++;
		}
	}
	printf("%d",cnt);
	return 0;
}

详细

answer.code: In function 'int trans1(int)':
answer.code:14:26: error: 'to_string' was not declared in this scope
  string tmp=to_string(ans);\x0d
                          ^
answer.code:15:17: error: 'stoi' was not declared in this scope
  return stoi(tmp);\x0d
                 ^
answer.code: In function 'int trans2(int)':
answer.code:27:26: error: 'to_string' was not declared in this scope
  string tmp=to_string(ans);\x0d
                          ^
answer.code:28:17: error: 'stoi' was not declared in t...