CuteMm @ 2022-06-26 20:19:05
#include<iostream>
#include<iomanip>
#include<math.h>
#include<cstdio>
using namespace std;
int main() {
int T;
cin >> T;
if (T == 1) {
cout << "I love Luogu!";
} else if (T == 2) {
cout << 2 + 4 << " " << 10 - 2 - 4;
} else if (T == 3) {
cout<<14/4<<endl;
cout<<14-(14%4)<<endl;
cout<<14%4;
} else if (T == 4) {
double sum=0;
sum=500.0/3.0;
printf("%6f",sum);
} else if (T == 5) {
cout<<(260+220)/(12+20)<<endl;
} else if (T == 6) {
int sum=0;
sum=6*6+9*9;
double sum1=sqrt(sum);
cout<<sum1;
} else if (T == 7) {
int jinqian=100;
jinqian+=10;
cout<<jinqian<<endl;
jinqian-=20;
cout<<jinqian<<endl;
jinqian=0;
cout<<jinqian<<endl;
} else if (T == 8) {
int r=5;
cout<<2*r*3.141593<<endl;
cout<<(r*r)*3.141593<<endl;
cout<<(4*3.141593*r*r*r)/3.0<<endl;
} else if (T == 9) {
int a=1,n,j,i;
cin>>n;
for(j=n-1;j>1;j--)
{
a=(a+1)*2;
}
cout<<a;
} else if (T == 10) {
int n1 = 8, t1 = 30, n2 = 10, t2 = 6; int t3 = 10;
double inc_rate = (1.0 * n1 * t1 - n2 * t2) / (t1 - t2);
double init_num = n2 * t2 - inc_rate * t2;
double ans = (init_num + t3 * inc_rate) / t3;
cout << ans << endl;
} else if(T==11){
double sum=8-5;
cout<<100.0/sum<<"秒";
} else if (T == 12) {
char a='A';
int b='M'-a;
a=a+18;
cout<<b<<endl;
cout<<a<<endl;
} else if (T == 13) {
double pi=3.141593;
double ab;
ab=4.0/3.0*(4*4*4+10*10*10)*pi;
cout<<(int)pow(ab,1.0/3);
} else if (T == 14) {
int i=110;
for(i=1;i*(120-i)<=3500;i++);
cout<<i;
}
return 0;
}
by lxuyinc @ 2022-06-26 20:27:05
小学题诶
第4个样例: 保留6位有效数字:要加上整数部分,共6位 。即保留3位小数...
by tangrunxi @ 2022-06-26 20:31:18
@sb114514 您的问题
问题
问题
问题 cout<<(double)(100/3);
尝试一下。
问题
问题
for(int i=0;i<110;++i){
if(i*(120-i)==3500){
cout<<i;
return 0;
}
}