caojiaming @ 2022-09-11 16:35:21
4、12、13点WA! 看看我的代码
#include<algorithm>
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
int T;
double p=3.141593;
cin>>T;
if (T == 1)
{
cout << "I love Luogu!";
}
else if (T == 2)
{
cout <<6<<" "<<4;
}
else if (T == 3)
{
cout<<3<<endl<<12<<endl<<2;
}
else if (T == 4)
{
printf("%.6f",500*1.0/(1.0*3));
}
else if (T == 5)
{
cout<<(260+220)/(12+20);
}
else if (T == 6)
{
cout<<sqrt(36+81);
}
else if (T == 7)
{
printf("%d\n%d\n%d",110,90,0);
}
else if (T == 8)
{
double ans1=5*2*p;
double ans2=25*p;
double ans3=125*4*p/3;
cout<<ans1<<endl<<ans2<<endl<<ans3;
}
else if (T == 9)
{
cout<<(((1+1)*2+1)*2+1)*2;
}
else if (T == 10)
{
//典型的牛吃草问题
cout<<9;
}
else if (T == 11)
{
cout<<100*1.0/(3*1.0);
}
else if (T == 12)
{
char i[26];
int id;
int k=0;
for(char j='A';j<='Z';j++,k++)
{
i[k]=j;
if(j=='M')
{
id=k;
}
}
cout<<id<<i[17];
}
else if (T == 13)
{
double a=164;
double b=pow(a,1.0/3);
int c=b;
cout<<c;
}
else if (T == 14)
{
cout<<50;
}
return 0;
}
哪里错了,给我指一下
by Katz @ 2022-09-11 16:37:29
那应该就是4,12和13错了吧
by SegTree @ 2022-09-11 16:40:41
@caojiaming
by caojiaming @ 2022-09-11 16:51:28
我改了的,12和13点还是错的
by SegTree @ 2022-09-11 17:00:35
@caojiaming 第12个点中间是换行不是空格,13公式错了,应该是
by caojiaming @ 2022-09-11 17:05:04
第13点 先乘π乘4/3后再除以一个 π乘4/3 和谁都不乘谁都不除就开3次方,不是一样吗?
by caojiaming @ 2022-09-11 17:34:07
#include<algorithm>
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
int T;
double p=3.141593;
cin>>T;
if (T == 1)
{
cout << "I love Luogu!";
}
else if (T == 2)
{
cout <<6<<" "<<4;
}
else if (T == 3)
{
cout<<3<<endl<<12<<endl<<2;
}
else if (T == 4)
{
printf("%.3f",500*1.0/(1.0*3));
}
else if (T == 5)
{
cout<<(260+220)/(12+20);
}
else if (T == 6)
{
cout<<sqrt(36+81);
}
else if (T == 7)
{
printf("%d\n%d\n%d",110,90,0);
}
else if (T == 8)
{
double ans1=5*2*p;
double ans2=25*p;
double ans3=125*4*p/3;
cout<<ans1<<endl<<ans2<<endl<<ans3;
}
else if (T == 9)
{
cout<<(((1+1)*2+1)*2+1)*2;
}
else if (T == 10)
{
//典型的牛吃草问题
cout<<9;
}
else if (T == 11)
{
cout<<100*1.0/(3*1.0);
}
else if (T == 12)
{
char i[26];
int id;
int k=0;
for(char j='A';j<='Z';j++,k++)
{
i[k]=j;
if(j=='M')
{
id=k;
}
}
cout<<id+1<<endl<<i[17];
}
else if (T == 13)
{
double a=1064;
double b=pow(a*p*4/3,1.0/3)/p/4*3;
int c=b;
cout<<c;
}
else if (T == 14)
{
cout<<50;
}
return 0;
}
看这个代码对吗?
by caojiaming @ 2022-09-11 17:48:22
哦 正方体,不需要除以派*4/3
by lin134 @ 2023-02-05 16:00:19
4:
cout<<500.0/3;
12:
cout<<'M'-'A'+1<<endl;
cout<<char('A'-1+18)<<endl;
13:
int r1=4,r2=10;
double pi=3.141593;
double v=4.0/3*pi*r1*r1*r1+4.0/3*pi*r2*r2*r2;
v=pow(v,1.0/3);
printf("%.0lf",v);