7.2 做题一遍就过的感觉简直太美好啦~然而我并没有测试数据QAQ
//program name digit #include<cstdio> #include<iostream> using namespace std; int main() { int a,count=0; cin>>a; while (a>0){ a=a/10; count++; } cout<<count; return 0; }
//program name daffodil #include<cstdio> #include<iostream> using namespace std; int main() { int a,b,c; for (a=1;a<=9;a++) for (b=0;b<=9;b++) for (c=0;c<=9;c++) if (a*a*a+b*b*b+c*c*c==100*a+10*b+c) cout<<100*a+10*b+c<<" "; return 0; }
//program name hanxin #include<cstdio> #include<iostream> using namespace std; int main() { int a,b,c,i; cin>>a>>b>>c; for (i=10;i<=100;i++) if (i % 3==a && i % 5==b && i % 7==c) { cout<<i<<" "; break; } if (i==101) cout<<"No answer"; return 0; }
//program name triangle #include<cstdio> #include<iostream> using namespace std; int main() { int n,i,j; cin>>n; for (i=1;i<=n;i++) { for (j=1;j<=i-1;j++) cout<<" "; for (j=1;j<=2*(n-i)+1;j++) cout<<"#"; cout<<" "; } return 0; }
7.3 要坚持练语法打下扎实基础啊~