#include
int main() {
int m,n;
n=0;
FILE *fin,*fout;
fin=fopen("data.in","rb");
fout=fopen("data.out","wb");
fscanf(fin,"%d",&m);
while(m>0){
n++;
m=m/10;
}
fprintf(fout,"%d",n);
fclose(fin);
fclose(fout);
return 0;
}
#include
#include
int main() {
FILE *fout;
// fin=fopen("data.in","rb");
fout=fopen("data.out","wb");
int i,hun,ten,gw;
double sum;
for(i=101;i<999;i++){
hun=i/100;
ten=i/10%10;
gw=i%10;
sum=pow(hun,3)+pow(ten,3)+pow(gw,3);
if(i==sum)fprintf(fout,"%d\n",i);
}
// fclose(fin);
fclose(fout);
return 0;
}
153
370
371
#include
int main() {
// cout << "!!!Hello World!!!" << endl;
// prints !!!Hello World!!!
int i,a,b,c,isanswer;
FILE *fin,*fout;
fin=fopen("data.in","rb");
fout=fopen("data.out","wb");
fscanf(fin,"%d%d%d",&a,&b,&c);
for(i=99;i>10;i--){
if(i%3==a&&i%5==b&&i%7==c){
isanswer=1;break;
}
}
if(isanswer==1)
fprintf(fout,"%d\n",i);
else fprintf(fout,"no answer");
fclose(fin);
fclose(fout);
return 0;
#include
int main(){
int i,j,n;
scanf("%d",&n);
for(i=0;i
include
int main(){
FILE *fin,*fout;
fin=fopen("data.in","rb");
fout=fopen("data.out","wb");
int m,n,i,k=0;
fscanf(fin,"%d",&n);
int *a=new int[n];
for(i=0;i
#include
int main() {
FILE *fin,*fout;
fin=fopen("data.in","rb");
fout=fopen("data.out","wb");
int n,i;
double sum=0;
fscanf(fin,"%d",&n);
for(i=1;i<=n;i++){
sum=sum+(double)1/i;
}
fprintf(fout,"%0.3lf\n",sum);
fclose(fin);
fclose(fout);
return 0;
}
3
1.833
后面就不引用文件了hh(●´∀`●)
#include
// pi/4=1-1/3+1/5-1/7+....
int main() {
int i,k=1;
double sum=0.0;
for(i=1;i<1e6;){
sum=sum+(double)k/i;
k=-k;
i=i+2;
}
printf("%0.6lf\n",sum);
return 0;
}
#include
// pi/4=1-1/3+1/5-1/7+....
int main() {
int i,k=1;
double sum=0.0;
for(i=1;i<1e6;){
sum=sum+(double)k/i;
k=-k;
i=i+2;
}
printf("%0.6lf\n",sum);
return 0;
}
#include
int main() {
int a,b,c;
scanf("%d%d%d",&a,&b,&c);
printf("%.*f\n",c,(double)a/b);
return 0;
}
#include
void permutation(int a,int &b,int &c){
int hun,ten,gw;
hun=a/100;
ten=a/10%10;
gw=a%10;
b+=hun+ten+gw;
c*=hun*ten*gw;
}
int main(){
int b,c;
int i,j,k;
for(i=123;i<=329;i++){
j=i*2;
k=i*3;
b=0;c=1;
permutation(i,b,c);
permutation(j,b,c);
permutation(k,b,c);
if(b==45&&c==362880){
printf("%d %d %d\n",i,j,k);
}
}
return 0;
}