name1ess_0123210 @ 2022-08-20 18:48:02
#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;
}
by bamboo12345 @ 2022-08-20 19:05:10
@bxqm210 估计是炸int了但是dev好像会帮你转成longlong
by name1ess_0123210 @ 2022-08-20 19:16:25
@bamboo123 啧,int改成long long还是过不了#10
by bamboo12345 @ 2022-08-20 20:22:02
@bxqm210 不要把下标为i的东西输出
by name1ess_0123210 @ 2022-08-21 18:13:02
@bamboo123 下标为i的?你指的是哪个?为啥?