白皮 Chapter 2

7.2 做题一遍就过的感觉简直太美好啦~然而我并没有测试数据QAQ

//program name digit
#include<cstdio>
#include<iostream>
using namespace std;
int main()
{
int a,count=;
cin>>a;
while (a>){
a=a/;
count++;
}
cout<<count;
return ;
}

digit

//program name daffodil
#include<cstdio>
#include<iostream>
using namespace std;
int main()
{
int a,b,c;
for (a=;a<=;a++)
for (b=;b<=;b++)
for (c=;c<=;c++)
if (a*a*a+b*b*b+c*c*c==*a+*b+c) cout<<*a+*b+c<<"\n";
return ;
}

daffodil

//program name hanxin
#include<cstdio>
#include<iostream>
using namespace std;
int main()
{
int a,b,c,i;
cin>>a>>b>>c;
for (i=;i<=;i++)
if (i % ==a && i % ==b && i % ==c)
{
cout<<i<<"\n";
break;
}
if (i==) cout<<"No answer";
return ;
}

hanxin

//program name triangle
#include<cstdio>
#include<iostream>
using namespace std;
int main()
{
int n,i,j;
cin>>n;
for (i=;i<=n;i++)
{
for (j=;j<=i-;j++) cout<<" ";
for (j=;j<=*(n-i)+;j++) cout<<"#";
cout<<"\n";
}
return ;
}

triangle

7.3 要坚持练语法打下扎实基础啊~

上一篇:nullptr和NULL 区别


下一篇:《C语言入门1.2.3—一个老鸟的C语言学习心得》—清华大学出版社炮制的又一本劣书及伪书