0x00dream @ 2024-01-14 20:28:43
#include<cstdio>
#include <cmath>
using namespace std;
#define PI 3.141593
int tao(int day){
int tao_zi;
if(day == 4){
return 1;
}
tao_zi = (tao(day+1)+1)*2;
return tao_zi;
}
int main() {
int T; //选择题目
scanf("%d",&T);
if (T == 1) {
printf("I love Luogu!");
} else if (T == 2) {
printf("%d %d",2+4,10-2-4);
} else if (T == 3) {
int a = 14/4;
int b = a*4;
int c = 14%4;
printf("%d\n%d\n%d",a,b,c);
} else if (T == 4) {
float a = 500;
float b = a/3;
printf("%.3f",b);
} else if (T == 5) {
int a = 260;
int v_a = 12;
int b = 220;
int v_b = 20;
int t = (a+b)/(v_a+v_b);
printf("%d",t);
} else if (T == 6) {
printf("%f", sqrt(6*6+9*9));
} else if (T == 7) {
int a = 100+10;
int b = a-20;
int c = 0;
printf("%d\n%d\n%d",a,b,c);
} else if (T == 8) {
double a,s,v;
a = 2*PI*5;
s = PI*5*5;
v = PI*5*5*5*4/3;
printf("%lf\n%lf\n%lf",a,s,v);
} else if (T == 9) {
int sum = tao(1);
printf("%d",sum);
} else if (T == 10) {
printf("%d",9);
} else if (T == 11) {
double a=100;
double t=a/3;
printf("%lf",t);
} else if (T == 12) {
char c[27]={' ','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S',
'T','U','V','W','X','Y','Z'};
for (int i = 0; i < 27; ++i) {
if('M' == c[i]){
printf("%d\n",i);
break;
}
}
printf("%c",c[18]);
} else if (T == 13) {
double v1 = PI*4*4*4*4/3;
double v2 = PI*10*10*10*4/3;
double v = v1+v2;
double a = pow(v,1.0/3);
printf("%lf",a);
} else if (T == 14) {
int a=1;//定价
int b=119; //报名人数
int sum = 0; //收到的报名费
while (a>0){
sum = a*b;
if(sum == 3500){
printf("%d",a);
break;
}
a++;
b--;
}
}
return 0;
}
by pbcoding @ 2024-01-18 22:03:20
@0x00dream\ 6:直接使用 cout 输出\ 8:直接使用 cout 输出\ 11:直接使用 cout 输出\ 13:如果结果不是整数,则舍去小数点之后的数字
by pbcoding @ 2024-01-18 22:04:25
题目中说的