BoooFar @ 2024-08-22 11:45:43
自认为算法并不复杂,不知道为什么超时
#include<bits/stdc++.h>
using namespace std;
int n,m;
int main(){
cin>>n;
m=abs(n);
if(n<0){
cout<<"-";
}
while(m%10==0){
m=m/10;
}
while(m>0){
cout<<m%10;
m=m/10;
}
return 0;
}
by houyunjie @ 2024-08-22 11:48:19
#include<bits/stdc++.h>
using namespace std;
int n,s=0;
int main()//以上应该都懂,不解释
{
cin>>n;//烦死了输入
while(n) s=s*10+n%10,n/=10;//如果n不是0,就一直s让一位,腾个0出来,n最后一位跟上去,再无情地抛弃了最后一位(突然想对n说:你无情你冷酷你无理取闹!)
cout<<s;//烦死了输出
return 0;
}
by tbdsh @ 2024-08-22 11:48:29
@BoooFar 当
by jntmhh @ 2024-08-22 11:49:32
#include <bits/stdc++.h>
using namespace std;
int main() {
int y,sum=0,n;
cin>>n;
while(n!=0)
{
y=n%10;
sum=sum*10+y;
n=n/10;
}
cout<<sum;
return 0;
}
by BoooFar @ 2024-08-22 11:50:34
@tbdsh 好的,谢谢!
by BoooFar @ 2024-08-22 11:53:57
@tbdsh 感谢,已AC
#include<bits/stdc++.h>
using namespace std;
int n,m;
int main(){
cin>>n;
m=abs(n);
if(n==0){
cout<<0;
return 0;
}
if(n<0){
cout<<"-";
}
while(m%10==0){
m=m/10;
}
while(m>0){
cout<<m%10;
m=m/10;
}
return 0;
}
by dream_dad @ 2024-08-22 12:09:39
@houyunjie 好像是题解