TLE能解决么

P1307 [NOIP2011 普及组] 数字反转

@[jokerXYH](/user/655236) 判断一下0不然第一个while死循环了ac代码 ``` #include<bits/stdc++.h> using namespace std; int main() { int x,i=0; cin>>x; if(x==0){ cout<<0; return 0; } if(x<0){ x=-x; cout<<"-"; } int a[10]; while(x%10==0){ x/=10; } while(x!=0){ a[i]=x%10; x=x/10; cout<<a[i]; i++; } } ```
by lxc_awa @ 2022-04-22 22:18:31


|