我用两个循环做的,不知道哪里出错了,大神指点

P1980 [NOIP2013 普及组] 计数问题

看不懂你的,我贴个简单的 ```cpp #include<iostream> using namespace std; int main() { int i,j,n,x,ans=0; cin>>n>>x; for(i=1;i<=n;i++) { j=i; while(j>0) { if(j%10==x) ans++; j/=10; } } cout<<ans<<endl; } ```
by XY_cpp @ 2017-10-03 20:05:41


|