徐熠3580751061 @ 2022-02-23 22:01:04
#include<stdio.h>
#include<math.h>
int main() {
int T;
scanf("%d",&T);
if (T == 1) {
printf("I love Luogu!\n");
} else if (T == 2) {
int a,b,c;
a=10,b=2,c=4;
printf("%d %d\n",b+c,a-b-c);
} else if (T == 3) {
int d,e;
d=14; e=4;
printf("%d\n",d/e);
printf("%d\n",d/e*e);
printf("%d",d-d/e*e);
} else if (T == 4) {
int a3,b3;
a3=500;
b3=3;
double c3;
c3=1.0*a3/b3;
printf("%0.3f\n",c3);
} else if (T == 5) {
int a1,b1,c1,d1;
a1=260,b1=12,c1=220,d1=20;
printf("%d\n",(a1+c1)/(b1+d1));
} else if (T == 6) {
int a2,b2;
a2=6,b2=9;
printf("%0.4f\n",sqrt(1.0*a2*a2+1.0*b2*b2));
} else if (T == 7) {
int x;
x=100;
printf("%d\n",x+10);
printf("%d\n",x+10-20);
printf("%d\n",0);
} else if (T == 8) {
int r;
double C,S,V;
r=5;
C=2*3.141593*r;
S=3.141593*r*r;
V=4.0/3.0*3.141593*r*r*r;
printf("%f\n",C);
printf("%f\n",S);
printf("%f\n",V);
} else if (T == 9) {
printf("%d\n",(((1+1)*2+1)*2+1)*2);
} else if (T == 10) {
double x1;
x1=1.0*(30*8-10*6)/(30-6);
double y1;
y1=10*6-6*x1;
double z;
z=(y1+x1*10)/10;
printf("%.f",z);
} else if (T == 11) {
printf("%0.4f",1.0*100/(8-5));
} else if (T == 12) {
printf("%d\n",'M'-'A'+1);
printf("%c",'A'+18-1);
} else if (T == 13) {
double V1,L;
V1=1.0*4/3*4*4*4*3.141593+1.0*4/3*10*10*10*3.141593;
L=pow(V1,1.0*1/3);
printf("%.f",L);
} else if (T == 14) {
printf("%d",50);
}
return 0;
}
by 芝麻馅儿汤圆 @ 2022-02-23 22:23:43
小数位数不对 cout和printf不太一样的 看题目要求,“直接用‘cout’输出”
by coldy_rainy @ 2022-02-23 22:44:32
@徐熠3580751061
这题建议用
by UnyieldingTrilobite @ 2022-02-23 23:49:18
@徐熠3580751061 使用 %g
这种东西,而不是 %f
(针对此题)
by 徐熠3580751061 @ 2022-02-24 14:30:14
@UnyieldingTrilobite Thanks♪(・ω・)ノ过了!
by gaokn @ 2022-07-09 18:35:59
@UnyieldingTrilobite 请问为什么呀