解题思路:
注意事项:
参考代码:
#includeusing namespace std; int main() { long long a; int count=0; cin>>a; for(int i=1;i<a+1;i++){ int t=i; do{ if(t%10==1) count++; }while(t/=10); } cout<<count<<endl; return 0; }
#include<iostream> using namespace std; int main() { long long a; int count=0; cin>>a; for(int i=1;i<a+1;i++){ int t=i; while(t){ if(t%10==1){ count++; t/=10; }else{ t/=10; } } } cout<<count<<endl; return 0; }
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题6.5 (C++代码)浏览:458 |
C语言程序设计教程(第三版)课后习题6.3 (C语言代码)from DQM浏览:672 |
演讲大赛评分 (C语言代码)浏览:1640 |
C语言程序设计教程(第三版)课后习题12.2 (C语言代码)浏览:767 |
C语言程序设计教程(第三版)课后习题6.10 (C语言代码)浏览:523 |
C语言程序设计教程(第三版)课后习题6.4 (C语言代码)浏览:681 |
C语言程序设计教程(第三版)课后习题1.6 (C语言代码)浏览:654 |
C语言程序设计教程(第三版)课后习题10.7 (C语言代码)浏览:616 |
银行业务队列浏览:1218 |
防御导弹 (C语言代码)浏览:2218 |