题目网站:WZOI
题目:
21.求正立方体表面积。
#include <iostream>
using namespace std;
int main(){
long long a;
cin>>a;
cout<<a*a*6;
return 0;
}
22.输出保留3位小数的浮点数
#include <bits/stdc++.h>
using namespace std;
int main(){
double a;
cin>>a;
printf("%.3f",a);
}
23.工资
#include<bits/stdc++.h>
using namespace std;
int main(){
long long a;
double b;
cin>>a>>b;
double c,d;
cin>>c;
cout<<"NUMBER = "<<a<<endl;
cout<<"SALARY = U$ ";
d=b*c;
printf("%.2lf",d);
return 0;
}
24.四舍五入
#include<bits/stdc++.h>
using namespace std;
int main(){
float a;
int b;
cin>>a>>b;
printf("%.*f",b,a);
return 0;
}
25.求梯形面积
#include<bits/stdc++.h>
using namespace std;
int main(){
float a,b,c,s;
cin>>a>>b>>c;
s=(a+b)*c/2;
printf("%.2f",s);
return 0;
}
26.梯形面积
#include<bits/stdc++.h>
using namespace std;
int main(){
float s;
s=25.0*160/15+160;
printf("%.2f",s);
}
27.求圆柱体表面积。
#include<bits/stdc++.h>
using namespace std;
int main(){
float r,h;
cin>>r>>h;
cout<<r*2*h*3.14+3.14*r*r*2;
return 0;
}
28.计算总成绩与平均成绩
#include<bits/stdc++.h>
using namespace std;
int main(){
float a,b,c,d,e,f;
cin>>a>>b>>c>>d;
e=a+b+c+d;
f=e/4;
printf("%.2f",e);
cout<<endl;
printf("%.2f",f);
return 0;
}
29.新平均成绩
#include<bits/stdc++.h>
using namespace std;
int main(){
float a,e;
int b,c,d;
cin>>a>>b>>c;
d=c-1;
e=(a*c-b)/d;
printf("%.3f",e);
return 0;
}
30.歌手大奖赛
#include<bits/stdc++.h>
using namespace std;
int main(){
double a;
a=9.6;
printf("%6.2lf",a);
return 0;
}