求指点,为何只有70分?

P1307 [NOIP2011 普及组] 数字反转

代码能调得好看一点吗?
by 少帅_zjm @ 2018-06-10 20:02:09


@[冷月无声](/space/show?uid=105604) 请在代码前加上```,代码后也加上. 例: ``` cout<<23333; ```
by 氷スイカ233 @ 2018-06-10 20:18:15


markdown
by 亚索s @ 2018-07-31 22:04:51


#include<iostream> #include<cstdio> #include<cmath> #include<cstdlib> using namespace std; int a[13]; int main() { int n,s=0,flag=0; cin>>n; if(n<0){ cout<<'-'; n=-n; } if(n==0) { cout<<'0'; return 0; } while(n>0) { s++; a[s]=n%10; n/=10; } for(int i=1;i<=s;i++) { if(a[i]!=0){ flag=1; cout<<a[i]; } if(a[i]==0&&flag!=1) continue; ** if(a[i]==0&&flag==1) cout<<a[i];**加上这步就对了 } }
by Daisy411 @ 2018-08-05 16:05:41


|