【WZOI】AC大礼包(1~150)【已更2023.5.20】

啥也别说了,上答案:

1.Hello World

#include <bits/stdc++.h>
using namespace std;

int main(){
    cout << "Hello World!";
}

2.打印Hello World

#include <bits/stdc++.h>
using namespace std;

int main(){
    cout<<"**************************"<<endl;
    cout<<"         Very    Good!"<<endl;
    cout<<"**************************";
}

3.默写数字

#include <bits/stdc++.h>
using namespace std;

int main(){
    int n;
    cin>>n;
    cout<<n;
}

4.A+B Problem

#include <bits/stdc++.h>
using namespace std;

int main(){
    int a,b,c;
    cin>>a>>b;
    cout<<a+b<<endl;
}

5.输出第二个整数

#include <bits/stdc++.h>
using namespace std;

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    cout<<b;
}

6.求一个数的前后两个数

#include <bits/stdc++.h>
using namespace std;

int main(){
    int n,x;
    cin>>n>>x;
    cout<<n-x<<endl<<n+x<<endl;
}

7.竖式计算

#include <bits/stdc++.h>
using namespace std;

int main() {
    int a,b;
    cin>>a>>b;
    printf("%10d\n%4c%6d\n-----------\n%10d",a,'+',b,a+b);
}

8.植树造林

#include <bits/stdc++.h>
using namespace std;

int main(){
    int a,b;
    cin>>a>>b;
    cout<<a*b<<endl;
}

9.求自行车总价

#include <bits/stdc++.h>
using namespace std;

int main(){
    int a;
    cin>>a;
    cout<<a*300;
}

10.三位数

#include <bits/stdc++.h>
using namespace std;

int main(){
    int g,s,b;
    cin>>s;
    b=s+1;
    g=b*2;
    cout<<b<<s<<g;
}

11.做蛋糕

#include <bits/stdc++.h>
using namespace std;

int main(){
    int a1,a2,a3,b1,b2,b3;
    cin>>a1>>a2>>a3>>b1>>b2>>b3;
    cout<<a1*b1+a2*b2+a3*b3<<endl;
}

12.计算(a+b)*c的值

#include <bits/stdc++.h>
using namespace std;

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    cout<<(a+b)*c;
}

13.求余数

#include <bits/stdc++.h>
using namespace std;

int main(){
    int a,b;
    cin>>a>>b;
    cout<<a%b;
}

14.计算(a+b)/c的值

#include <bits/stdc++.h>
using namespace std;

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    cout<<(a+b)/c;
}

15.小玉买文具

#include <bits/stdc++.h>
using namespace std;

int main(){
    int a,b;
    cin>>a>>b;
    cout<<(a*10+b)/19;
}

16.买苹果

#include <bits/stdc++.h>
using namespace std;

int main(){
    int a,b;
    cin>>a;
    cout<<(a/3)*4+a%3;
}

17.买牛奶

#include <bits/stdc++.h>
using namespace std;

int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<d/a*a/b*c+(d/a);
}

18.小鱼的游泳时间

#include <bits/stdc++.h>
using namespace std;

int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<((c-a)*60+d-b)/60<<" "<<((c-a)*60+d-b)%60;
}

19.周长与面积

#include <bits/stdc++.h>
using namespace std;

int main(){
    int a,b;
    cin>>a>>b;
    cout<<"perimeter="<<(a+b)*2<<endl<<"area="<<a*b;
}

20.求筝形面积

#include <bits/stdc++.h>
using namespace std;

int main(){
    long long a,b;
    cin>>a>>b;
    cout<<a*b;
}

21.求正立方体表面积

#include <bits/stdc++.h>
using namespace std;

int main(){
    int a;
    cin>>a;
    cout<<a*a*6;
}

22.输出保留3位小数的浮点数

#include <bits/stdc++.h>
using namespace std;

int main(){
    double x;
    cin>>x;
    cout<<fixed<<setprecision(3)<<x;
}

23.工资

#include<bits/stdc++.h>
using namespace std;
int main()
{
	double a,b,c,s;
	cin>>a>>b>>c;
	s=b*c;
	cout<<"NUMBER = "<<a<<endl<<"SALARY = U$ ";
	printf("%0.2lf",s);
	return 0;
}

24.四舍五入

#include <bits/stdc++.h>
using namespace std;

int main(){
    int y;
    double x;
    cin>>x>>y;
    cout<<fixed<<setprecision(y)<<x;
}

25.求梯形面积

#include <bits/stdc++.h>
using namespace std;

int main(){
    double a,b,c;
    cin>>a>>b>>c;
    cout<<fixed<<setprecision(2)<<(a+b)*c/2;
}

26.梯形面积

#include <bits/stdc++.h>
using namespace std;

int main(){   
    double a;
    cout<<fixed<<setprecision(2)<<160.0*2/15*(15+25)/2;
}

27.求圆柱体表面积

#include <bits/stdc++.h>
using namespace std;

int main(){
    double r,h;
    cin>>r>>h;
    cout<<fixed<<setprecision(2)<<2*(3.14*r*r)+2*(3.14*r*h);
}

28.计算总成绩与平均成绩

#include <bits/stdc++.h>
using namespace std;

int main(){
    double a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<fixed<<setprecision(2)<<a+b+c+d<<endl<<(a+b+c+d)/4;
}

29.新平均成绩

#include <bits/stdc++.h>
using namespace std;

int main(){
    double x,score,n;
    cin>>x>>score>>n;
    cout<<fixed<<setprecision(3)<<(x*n-score)/(n-1);
}

30.歌手大奖赛

#include <bits/stdc++.h>
using namespace std;

int main(){
    double score;
    printf("%6.2lf",((9.6*6)-((9.6*12)-(9.4*5)-(9.8*5)))/4);
}

31.奇葩的饭店

#include <bits/stdc++.h>
using namespace std;

int main(){
    double a,b;
    cin>>a>>b;
    cout<<fixed<<setprecision(4)<<b/(a/100);
}

32.猜数游戏

#include <bits/stdc++.h>
using namespace std;

int main(){
    int x;
    cin>>x;
    cout<<(x*1000+x)/7/11/13;
}

33.求根号x的值

#include <bits/stdc++.h>
using namespace std;

int main(){
    int x;
    cin>>x;
    cout<<fixed<<setprecision(3)<<sqrt(x);
}

34.求logx

#include <bits/stdc++.h>
using namespace std;

int main(){
    double x;
    cin>>x;
    cout<<fixed<<setprecision(3)<<log(x)<<endl<<log10(x)<<endl<<log2(x);
}

35.求两者较大值的max函数的用法

#include <bits/stdc++.h>
using namespace std;

int main(){
    char c;
    int a,b;
    cin>>a>>c>>b;
    cout<<"max="<<max(a,b);
}

36.求自行车和三轮车各是多少辆

#include <bits/stdc++.h>
using namespace std;

int main(){
    int a,b;
    cin>>a>>b;
    cout<<(a*3-b)/(3-2)<<" "<<(b-a*2)/(3-2);
}

37.鸡兔同笼

#include <bits/stdc++.h>
using namespace std;

int main(){
    int x,y,m,n;
    cin>>x>>y;
    cout<<(x-(y*2))/(4-2)<<" "<<((y*4)-x)/(4-2);
}

38.计算路程

#include <bits/stdc++.h>
using namespace std;

int main(){
    double v,t;
    cin>>v>>t;
    cout<<fixed<<setprecision(2)<<v*t;
}

39.带余除法

#include <bits/stdc++.h>
using namespace std;

int main(){
    int a,b;
    cin>>a>>b;
    cout<<a/b<<" "<<a%b;
}

40.交换门牌号


                
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值