WZOI(21至30题代码)

 题目网站: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;
} 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值