#10WA掉了,但是下载数据后在本地运行的数据与之一致。怎么回事???
查看原帖
#10WA掉了,但是下载数据后在本地运行的数据与之一致。怎么回事???
758581
name1ess_0123210楼主2022/8/20 18:48

#10 cin:-800901860 cout:-68109008

###下附代码

#include<bits/stdc++.h>

using namespace std;

int main()
{
	int N;
	bool flag=1;
	string num;
	int temp,i=0;//i是计数器 
	cin>>N;
	if(N<0)
	{
		flag=0;
		N=N*(-1);
	}
	if(N!=0)
	{
		while(N>0)
		{
			temp=N%10;
			N/=10;
			if(i==0&&temp==0)
			{
				continue;
			}
			num[i]=(char)(temp+48);
			i++;
		}
		if(flag==1)
		{
			for(int j=0;j<=i;j++)
			{
				cout<<num[j];
			}
		}
		else
		{
			cout<<'-';
			for(int j=0;j<=i;j++)
			{
				cout<<num[j];
			}
		}	
	}
	else
	{
		cout<<'0';
	}
	return 0;
} 

###本萌新第一次发帖,先提前谢谢大佬

2022/8/20 18:48
加载中...