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; }
digit
//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<<"\n"; return 0; }
daffodil
//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<<"\n"; break; } if (i==101) cout<<"No answer"; return 0; }
hanxin
//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<<"\n"; } return 0; }
triangle
7.3 要坚持练语法打下扎实基础啊~
时间: 2024-10-06 22:07:01