大佬我没法去零,。。

P1307 [NOIP2011 普及组] 数字反转

最后一个花括号为什么不对齐啊。。。
by Lhc_fl @ 2018-08-23 13:55:57


```cpp #include <iostream> using namespace std; int main(){ char f; int n,t,d,nf=0,u; cin>>n; if(n<0){ f='-'; t=0-n; cout<<f; }else{ t=n; } if(n<10&&n>-10){ cout<<n; }else{ for(;t>0;){ u=t%10; if(u!=0||nf!=0){ cout<<u; nf=1; } t=t/10; } } return 0; } ```
by yangruiping @ 2018-08-23 14:11:48


AC码
by yangruiping @ 2018-08-23 14:12:09


@[Snake_e](/space/show?uid=94504)
by yangruiping @ 2018-08-23 14:17:50


``` #include <iostream> using namespace std; int ans; int main() { int n; cin >> n; while(n) { ans=ans*10+n%10; n/=10; } cout << ans; return 0; } ```
by Billy●Herrington @ 2018-09-08 10:46:41


|