https://www.acwing.com/problem/content/447/
水题。
1 #include<iostream> 2 using namespace std; 3 int main(void){ 4 int n; 5 cin>>n; 6 int res=0; 7 while(n){ 8 int t=n%10; 9 n/=10; 10 res=res*10+t; 11 } 12 cout<<res; 13 return 0; 14 }
https://www.acwing.com/problem/content/447/
水题。
1 #include<iostream> 2 using namespace std; 3 int main(void){ 4 int n; 5 cin>>n; 6 int res=0; 7 while(n){ 8 int t=n%10; 9 n/=10; 10 res=res*10+t; 11 } 12 cout<<res; 13 return 0; 14 }