求助

P1554 梦中的统计

在```s=a[i]/10;```后面加一行```a[i]/=10;```
by hpbl @ 2018-12-07 21:54:30


@[sb007ylx](/space/show?uid=78540)
by hpbl @ 2018-12-07 21:54:46


@[lhy930](/space/show?uid=60899) 这个有啥用呢
by WA我最萌 @ 2018-12-07 21:54:56


否则```a[i]```就不会变,那么就永远不会跳出那个```while```了
by hpbl @ 2018-12-07 21:55:43


@[lhy930](/space/show?uid=60899) 谢谢
by WA我最萌 @ 2018-12-07 21:56:52


@[sb007ylx](/space/show?uid=78540) s=a[i]%10;
by Smile_Cindy @ 2018-12-07 22:06:48


@[sb007ylx](/space/show?uid=78540) ```cpp #include<iostream> using namespace std; long long m,n; int s; int s1,s2,s3,s4,s5,s6,s7,s8,s9,s0; int a[500001]; int main(){ cin>>m>>n; for(int i=m;i<=n;i++){ a[i-m]=i; while(a[i-m]>0){ s=a[i-m]%10; if(s==1) s1++; if(s==2) s2++; if(s==3) s3++; if(s==4) s4++; if(s==5) s5++; if(s==6) s6++; if(s==7) s7++; if(s==8) s8++; if(s==9) s9++; if(s==0) s0++; a[i-m]/=10; } } cout<<s0<<' '<<s1<<' '<<s2<<' '<<s3<<' '<<s4<<' '<<s5<<' '<<s6<<' '<<s7<<' '<<s8<<' '<<s9; return 0; } ```
by Smile_Cindy @ 2018-12-07 22:08:07


@[Alpha](/space/show?uid=87058) 谢谢
by WA我最萌 @ 2018-12-07 22:08:16


@[Alpha](/space/show?uid=87058) 我RE三个点
by WA我最萌 @ 2018-12-07 22:10:44


@[sb007ylx](/space/show?uid=78540) 不能直接用a[i],而应该用a[i-m]
by Smile_Cindy @ 2018-12-08 10:51:26


| 下一页