SZ2528 @ 2020-05-10 21:15:30
代码:
#include<bits/stdc++.h>
using namespace std;
int main() {
int n;
cin>>n;
switch(n) {
case 1:
cout<<"I love Luogu!"<<endl;
break;
case 2:
cout<<2+4<<" "<<10-2-4<<endl;
break;
case 3:
cout<<int(14/4)<<" "<<" "<<14-int(14/4)*4<<endl;
break;
case 4:
printf("%.3lf",500.0/3);
break;
case 5:
cout<<(260+220)/(12+20)<<endl;
break;
case 6:
cout<<sqrt(6*6+9*9)<<endl;
break;
case 7:
cout<<100+10<<" "<<100+10-20<<" "<<0<<endl;
break;
case 8:
cout<<5*1.0*2*3.141593<<" "<<3.141593*5*5<<" "<<4.0/3*3.141593*3*3*3<<endl;
break;
case 9:
int n=4,peach=1;
for(int i=0; i<n-1; i++) {
peach++;
peach*=2;
}
cout<<peach<<endl;
break;
case 10:
cout<<9<<endl;
break;
case 11:
cout<<100*1.0/(5+8)<<endl;
break;
case 12:
cout<<int('M'-'A'+1)<<endl<<char('A'-1+18)<<endl;
break;
case 13:
cout<<pow((4.0/3*3.141593*4*4*4)+(4.0/3*3.141593*10*10*10),1.0/3)<<endl;
break;
case 14:
cout<<50<<endl;
break;
}
return 0;
}
by KaguyaH @ 2020-05-10 21:28:38
所有用大括号套起来的代码块内外可以重复定义,但同一个代码块内不能
by iMya_nlgau @ 2020-05-10 21:28:50
@SZ棋 看看这个
https://blog.csdn.net/zzwdkxx/article/details/27561393
by SZ2528 @ 2020-05-14 18:13:41
@KHIN 有个蒟蒻真的看不懂这代码
by SZ2528 @ 2020-05-14 19:07:29
啊, AC 了