【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.交换门牌号

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

int main(){
    int s;
    cin>>s;
    cout<<s%10<<s/10;
}

41.密码

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

int main(){
    long long m,s=1,i;
    cin>>m;
    for(i=m;i>m-3;i--)s*=i;
    cout<<s;
}

42.浮点数向零舍入

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

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

43.计算浮点数相除的余数

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

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

44.整型数据类型存储空间大小

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

int main(){
    long long a;
    int b;
    short c;
    cout<<sizeof(a)<<" "<<sizeof(b)<<" "<<sizeof(c);
}

45.浮点型数据类型存储空间大小

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

int main(){
    float a;
    double b;
    cout<<sizeof(a)<<" "<<sizeof(b);
}

46.其他基本数据类型存储空间大小

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

int main(){
    bool a;
    char b;
    cout<<sizeof(a)<<" "<<sizeof(b);
}

47.空格分隔输出

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

int main(){
    char a; int b;  float c;    double d;
    cin>>a>>b>>c>>d;
    cout<<fixed<<setprecision(6)<<a<<" "<<b<<" "<<c<<" "<<d<<endl;
}

48.整型与布尔型的转换

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

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

49.字符三角形

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

int main(){
    char a;
    cin>>a;
    cout<<"  "<<a<<endl<<" "<<a<<a<<a<<endl<<a<<a<<a<<a<<a<<endl;
}

50.字符菱形

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

int main(){
    char a;
    cin>>a;
    cout<<"  "<<a<<endl<<" "<<a<<a<<a<<endl<<a<<a<<a<<a<<a<<endl<<" "<<a<<a<<a<<endl<<"  "<<a<<endl;
}

51.读取单个字符的getchar()函数

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

int main(){
    char c;
    c=getchar();
    cout<<c<<endl;
}

52.打印ASCII码

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

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

53.打印字符

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

int main(){
    int b;
    cin>>b;
    cout<<char(b);
}

54.大写字母转小写字母

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

int main(){
    char a;
    cin>>a;
    cout<<char(a+32);
}

55.特殊输出

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

int main(){
    int a,b;
    cin>>a>>b;
    printf("%*d\n%0*d\n%-*d\n",b,a,b,a,b,a);
}

56.特殊输出2

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

int main(){
    double a;
    int b;
    cin>>a>>b;
    printf("%*.3lf\n%0*.3lf\n%-*.3lf\n",b,a,b,a,b,a);
}

57.字符变换

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

int main(){
    char c1,c2,c3;
    int a1,a2,a3;
    cin>>c1>>c2>>c3>>a1>>a2>>a3;
    cout<<char(c1+pow(2,a1))<<" "<<char(c2+pow(2,a2))<<" "<<char(c3+pow(2,a3))<<" ";
}

58.加密算法

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

int main(){
    char a;
    cin>>a;
    cout<<char(122-a+97);
}

59.甲流疫情死亡率

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

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

60.计算多项式的值

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

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

61.数列取数

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

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

62.填充矩形

#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long a,b,c,d;
	cin>>a>>b>>c;
	d=(a/c)*(b/c);
	cout<<d;
    return 0;
}

63.大象喝水

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

int main(){
    int h,r;
    cin>>h>>r;
    cout<<ceil(20000/(3.14159*r*r*h));
}

64.求等差为3的数列

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

int main(){
    int a;
    cin>>a;
    cout<<(2+(a-1)*3+2)*a/2;
}

65.等差数列末项计算

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

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

66.计算线段长度

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

int main(){
    int Xa,Ya,Xb,Yb;
    double a;
    cin>>Xa>>Ya>>Xb>>Yb;
    cout<<fixed<<setprecision(3)<<double(abs(sqrt((Xb-Xa)*(Xb-Xa)+(Yb-Ya)*(Yb-Ya))));
}

67.计算折线长度

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

int main(){
    double Xa,Ya,Xb,Yb,Xc,Yc,a=0;
    cin>>Xa>>Ya>>Xb>>Yb>>Xc>>Yc;
    a+=sqrt(abs((0-Xa)*(0-Xa)+(0-Ya)*(0-Ya)));
    a+=sqrt(abs((Xb-Xa)*(Xb-Xa)+(Yb-Ya)*(Yb-Ya)));
    a+=sqrt(abs((Xc-Xb)*(Xc-Xb)+(Yc-Yb)*(Yc-Yb)));
    cout<<fixed<<setprecision(5)<<a;
}

68.送午饭

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

int main(){
    int x1,y1,x2,y2,h,v;
    double a=0;
    cin>>h>>v>>x1>>y1>>x2>>y2;
    a+=abs(sqrt((x1-0)*(x1-0)+(y1-0)*(y1-0)));
    a+=abs(sqrt((x2-0)*(x2-0)+(y2-0)*(y2-0)));
    a+=h;a/=v;
    cout<<fixed<<setprecision(2)<<a;
}

69.计算曼哈顿距离

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

int main(){
    double x1,y1,x2,y2,a=0;
    cin>>x1>>y1>>x2>>y2;
    a=abs(x1-x2)+abs(y1-y2);
    cout<<fixed<<setprecision(3)<<abs(x1-x2)+abs(y1-y2);
}

70.计算球的体积

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

int main(){
    double x;
    cin>>x;
    cout<<fixed<<setprecision(2)<<4.0/3*3.14*x*x*x;
}

71.计算并联电阻的阻值

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

int main(){
    double r1,r2;
    cin>>r1>>r2; 
    cout<<fixed<<setprecision(2)<<1/(1/r1+1/r2);
}

72.求面积差

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

int main() {
    cout<<0.1642;
}

73.整数反转

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

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

74.变量交换

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

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

75.交换三个字符并输出

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

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

76.计算塔高

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

int main() {
    double l,a,b,m;
    const double PI=3.14159;
    cin>>l>>a>>b;
    a=a/180*PI;
    b=b/180*PI;
    m=l/(1/tan(b)-1/tan(a));
    printf("%.3f", m);
}

77.判断奇偶

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

int main(){
    int a;
    cin>>a;
    if(a%2==0)cout<<"even";
    else cout<<"odd";
}

78.判断是否被5整除

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

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(a%5==0 && b%5==0 && c%5==0)cout<<"Y es.";
    else cout<<"No_";
}

79.判断一个数能否同时被3和5整除

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

int main(){
    int n;
    cin>>n;
    if(n%5==0&&n%3==0)cout<<"YES";
    else cout<<"NO";
}

80.打车费用

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

int main() {
    double lucheng,shijian,feiyong=0;
    cin>>lucheng>>shijian;
    if(lucheng>10)feiyong=11+(10-2)*1.8+(lucheng-10)*1.8*1.5;
    else if(lucheng>2)feiyong=11+(lucheng-2)*1.8;
    else feiyong=11;
    feiyong+=int(shijian/3);
    cout<<fixed<<setprecision(1)<<feiyong;
}

81.登录程序

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

int main(){   
    int username=0,password=0;
    cin>>username>>password;
    if(username==202201)
        if(password==123456)cout<<"welcome!";
        else cout<<"wrong password!"; 
    else cout<<"wrong user!";
}

82.旅游景点

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

int main(){
    double m;
    cin>>m;
    if(m<1.2) cout<<"free";
    else if(m>=1.2 && m<=1.5) cout<<"half-price ticket";
    else if(m>1.5) cout<<"full ticket";
}

83.判断超速

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

int main(){   
    double s,t;
    cin>>s>>t;
    if(3600/t*s>=100) cout<<fixed<<setprecision(2)<<"yes"<<endl<<3600/t*s;
    else cout<<"no";
}

84.区间测速

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

int main(){   
    double s,t;
    cin>>s>>t;
    if(3600/t*s>=100){
      cout<<fixed<<setprecision(2);
      if(3600/t*s>100 && 3600/t*s<120) cout<<"<20%";
      else if(3600/t*s>=120 && 3600/t*s<150) cout<<"<50%";
      else if(3600/t*s>=150 && 3600/t*s<170) cout<<"<70%";
      else if(3600/t*s>=170) cout<<">=70%";
      cout<<endl<<3600/t*s;
    }
    else cout<<"no";
}

85.判断闰年

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

int main(){   
    int nian;
    cin>>nian;
    if(nian%4==0&&nian%100||nian%400==0) cout<<"Y";
    else cout<<"N";
}

86.奇偶ASCII值判断

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

int main(){   
    char a;
    cin>>a;
    if(int(a)%2==0)cout<<"NO";
    else cout<<"YES";
}

87.整数大小比较

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

int main(){   
    long long a,b;
    cin>>a>>b;
    if(a>b) cout<<">";
    else if(a==b) cout<<"=";
    else if(a<b) cout<<"<";
}

88.判断是否为两位数

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

int main(){   
    long long a;
    cin>>a;
    cout<<a>=10&&a<=99;
}

89.测量体温

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

int main(){
    double t;
    cin>>t;
    if(t>=36.5 && t<=37.5) cout<<"Yes";
    else cout<<"No";
}

90.奇数偶数

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

int main(){
    int a;
    cin>>a;
    if(a%2==0)cout<<a-1;
    else cout<<a*2;
}

91.计算BMI指数

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

int main(){
    int kg;
    double m,BMI;
    cin>>kg>>m;
    BMI=kg/m/m;
    if(BMI<18.5) cout<<"thin!";
    else if(BMI>=18.5&&BMI<=25) cout<<"normal!";
    else cout<<"fat!";
}

92.运动打卡

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

int main(){
    int h;
    cin>>h;
    if(h<0) cout<<"error!";
    else if(h<30) cout<<"0";
    else if(h<45) cout<<"300";
    else if(h<60) cout<<"450";
    else cout<<"500";
}

93.星期几

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

int main(){
    int h;
    cin>>h;
    if(h<1||h>7)cout<<"input error!";
    else if(h==1) cout<<"Monday";
    else if(h==2) cout<<"Tuesday";
    else if(h==3) cout<<"Wednesday";
    else if(h==4) cout<<"Thursday";
    else if(h==5) cout<<"Friday";
    else if(h==6) cout<<"Saturday";
    else cout<<"Sunday";
}

94.晶晶赴约会

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

int main(){
    int d;
    cin>>d;
    if(d==1||d==3||d==5)cout<<"NO";
    else cout<<"YES";
}

95.过山车

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

int main(){
    int h1,h2,a,b,c,x=0;
    cin>>h1>>h2>>a>>b>>c;
    if(a<h1 && a>h2)x++;
    if(b<h1 && b>h2)x++;
    if(c<h1 && c>h2)x++;
    if(x)cout<<x;
    else cout<<-1;
}

96.拯救暴风城

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

int main(){
    int n,x,m;
    cin>>n>>x>>m;
    if(x*m>=n) cout<<"juruo pks!";
    else cout<<"ruoji cchuan!";
}

97.次方比较

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

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(pow(a,b)<c) cout<<"Pks dalao!";
    else if(pow(a,b)==c) cout<<"pKs dalao!!";
    else cout<<"pkS dalao!!!";
}

98.托运价格

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

int main() {
    double w,a,b;
    scanf("%lf,%lf",&w,&a); 
    w*=1000;
    if(w==0)b=0;
    else if(w<=10)b=2.33;
    else if(w>10)b=2.33+(w-10)*1.165;
    cout<<fixed<<setprecision(3)<<b<<endl<<a-b;
}

99.计算甜甜圈面积

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

int main(){
    long double a,R,r;
    cin>>R>>r;
    if(R<=r)cout<<0;
    else cout<<fixed<<setprecision(11)<<3.14159265359*(pow(R,2)-pow(r,2));
}

100.苹果和虫子

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

int main() {
    int n,x,y,b;
    cin>>n>>x>>y;
    b=y/x;
    if(y%x!=0)b+=1;
    if(n-b<0)b=n;
    cout<<n-b;
}

101.计算成绩

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

int main(){
    double a,na,b,nb,c,nc,x,y;
    cin>>a>>na>>b>>nb>>c>>nc;
    x=(na-a)/a,y=(na-a+nb/(1+b)*b+c)/(a+nb/(1+b)+nc-c);
    if (x>=y)printf("%.2f",x-y);
    else cout<<"tan90";
}

102.选举

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

int main() {
    int n,m,a=0,b=0;
    for(int i=0;i<4;i++)
        cin>>n>>m,a+=n,b+=m;
    if(a>b)cout<<"qindingla!";
    else cout<<"too naive!";
}

103.说谎

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

int main(){
    bool a,b,c,d,a1,a2,a3,a4;
    cin>>a>>b>>c>>d,a4=1;
    if(a4==d)a3=1;
    else a3=0;
    if(a3==c)a2=1;
    else a2=0;
    if(a2==b)a1=1;
    else a1=0;
    cout<<a1<<" "<<a2<<" "<<a3<<" "<<a4;
}

104.装修

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

int main() {
    int n,m,k;
    cin>>n>>m>>k;
    if(m<k)cout<<m*n;
    else cout<<k*n;
}

105.英雄战士

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

int main() {
    int a,b,m,h;
    cin>>a>>b>>m>>h;
    if(min(h,m)>=min(a,b))cout<<"terrorist win";
    else cout<<"counter terrorist win";
}

106.追赶问题

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

int main(){
    int v1,v2;
    double x,t;
    cin>>x>>v1>>v2>>t;
    cout<<fixed<<setprecision(2);
    if(x/(v1-v2)<t)cout<<"Yes"<<" "<<x/(v1-v2);
    else cout<<"No";
}

107.撕票

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

int main(){
    long long time,ph,n,i;
    cin>>time>>ph>>n;
    if(n*time>ph)cout<<"\"PKS has been killed!\"";
    else cout<<"\"You have been killed by PKS!\"";
}

108.四叶玫瑰

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

int main() {
    int ge,shi,bai,qian,shu;
    cin>>shu;
    qian=shu/1000,bai=(shu/10)%10,shi=(shu/100)%10,ge=shu%10;
    if(pow(qian,4)+pow(bai,4)+pow(shi,4)+pow(ge,4)==shu)cout<<"yes";
    else cout<<"no";
}

109.判断分数

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

int main(){ 
    long long n,m,a,x,b,y;
    cin>>n>>m>>a>>x>>b>>y;
    if(a==x/m&&b==y/m)cout<<2333;
    else cout<<((abs(a-x/m)>abs(b-y/m))?abs(a-x/m)*m:abs(b-y/m)*m);
}

110.天命数

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

int main(){
    long long k,n,m,shu;
    cin>>n>>m>>k;
    if(k==1)shu=max(n,m)/min(n,m);
    if(k==2)shu=n+m;
    if(k==3)shu=(max(n,m)/min(n,m)*(n+m))/max(n,m)%min(n,m);
    if(shu==0)cout<<"cangtianyisi,huangtiandangli";
    else cout<<shu;
}

111.分段函数

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

int main(){
    int x;
    cin>>x;
    if(x>0)cout<<1<<endl;
    else if(x==0)cout<<0<<endl;
    else if(x<0)cout<<-1<<endl;
}

112.商场折扣

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

int main() {
    double x;
    cin>>x;
    cout<<fixed<<setprecision(2);
    if(x<250)cout<<x;
    if(x>=250 && x<500)cout<<x*0.95;
    if(x>=500 && x<1000)cout<<x*0.9;
    if(x>=1000 && x<2000)cout<<x*0.85;
    if(x>=2000)cout<<x*0.8;
}

113.成绩评定

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

int main() {
    int a;
    cin>>a;
    if(a>=85)cout<<"A";
    else if(a>=60&&a<85)cout<<"P";
    else cout<<"E";
}

114.求方程的解(简化版)

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

int main() {
    double x1,x2,A,B,C,disc;
    cin>>A>>B>>C;
    disc=B*B-4*A*C;
    if(disc>0)
        x1=(-B+sqrt(disc))/(2*A),x2=(-B-sqrt(disc))/(2*A),
        cout<<fixed<<setprecision(2),
        cout<<max(x1,x2)<<" "<<min(x1,x2)<<endl;
}

115.求直角梯形最长对角线

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

int main() {
    long double a,b,c,d,e;
    cin>>a>>b>>c;
    d=max(a,b),e=sqrt(d*d+c*c);
    cout<<fixed<<setprecision(1)<<e;
}

116.重组最大数

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

int main() {
    int x,a,b,c;
    cin>>x;
    a=x/100,b=(x/10)%10,c=x%10;
    for(x=0;x<2;x++){
        if(b>a)swap(a,b);
        if(c>b)swap(b,c);
    } cout<<a<<b<<c;
}

117.求三角形面积

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

int main() {
    double a,b,c,p,s;
    cin>>a>>b>>c;
    if(a+b>c&&a+c>b&&b+c>a) {
        p=(a+b+c)/2,
        s=sqrt(p*(p-a)*(p-b)*(p-c)),
        cout<<fixed<<setprecision(2)<<s;
    }else cout<<"Can't";
}

118.计算邮件收费

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

int main() {
    double kg,sum=0;
    cin>>kg;
    if(kg>1) sum=1.5+(kg-1)*0.8;
    else sum=1.5*kg;
    cout<<fixed<<setprecision(2)<<sum;
}

119.称号

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

int main() {
    int n;
    cin>>n;
    if(n>=0 && n<3)n=2;
    switch(n){
        case 2: cout<<"You are a Foolish Man."; break;
        case 3: cout<<"You are on a Killing Spree."; break;
        case 4: cout<<"You are Dominating."; break;
        case 5: cout<<"You have a Mega-Kill."; break;
        case 6: cout<<"You are Unstoppable."; break;
        case 7: cout<<"You are Wicked Sick."; break;
        case 8: cout<<"You have a M-m-m-m....Monster Kill."; break;
        case 9: cout<<"You are Godlike."; break;
        default: cout<<"You are Beyond Godlike (Somebody kill him!).";
    }
}

120.有一门课不及格的学生

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

int main(){
    int a,b;
    cin>>a>>b;
    cout<<int(a<60&&b>=60||a>=60&&b<60);
}

121.计算火柴棒个数

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

int main() {
    int x;
    cin>>x;
    switch(x){
        case 0: cout<<"6"; break;
        case 1: cout<<"2"; break;
        case 2: cout<<"5"; break;
        case 3: cout<<"5"; break;
        case 4: cout<<"4"; break;
        case 5: cout<<"5"; break;
        case 6: cout<<"6"; break;
        case 7: cout<<"3"; break;
        case 8: cout<<"7"; break;
        default:cout<<"6";
    }
}

122.最大数输出

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

int main(){
	long long a,b,c;
	cin>>a>>b>>c;
	if(a>b&&a>c)cout<<a;
	if(b>a&&b>c)cout<<b;
	if(c>b&&c>a)cout<<c;
	return 0;
}

123.点和正方形的关系

#include <bits/stdc++.h>
using namespace std;
int x,y;
int main()
{
  cin>>x>>y;
  if(x<=1&&y<=1&&x>=-1&&y>=-1)cout<<"yes";
  else cout<<"no";
  return 0;
}

124.三角形判断

#include<bits/stdc++.h>
using namespace std;
int main() 
{
	int b1,b2,b3;
	cin>>b1>>b2>>b3;
	if (b1+b2>b3 && b1+b3>b2 && b3+b2>b1) cout<<"yes";
	else cout<<"no";

}

125.识别三角形

#include<bits/stdc++.h>
using namespace std;
int main() 
{
	int b1,b2,b3;
	cin>>b1>>b2>>b3;
	if (b1+b2>b3 && b1+b3>b2 && b3+b2>b1) 
	{
		if (b1==b2 && b2==b3) cout<<"Equilateral";
		else if (b1*b1+b2*b2==b3*b3 || b1*b1+b3*b3==b2*b2 || b3*b3+b2*b2==b1*b1) cout<<"Right";
		else if (b1==b2 ||b1==b3 || b2==b3) cout<<"Isosceles";
		else cout<<"General";
	}
	else cout<<"NO";
	

}

126.骑车与走路

#include<bits/stdc++.h>
using namespace std;
int main() 
{
	long double s,b,w;
	cin>>s;
	b=s/3.0+50;
	w=s/1.20;
	if (b<w) cout<<"Bike";
	else if (w<b) cout<<"Walk";
	else cout<<"All";
}

127.分段函数

#include <bits/stdc++.h>
using namespace std;
int main()
{
  double x;
  cin>>x;
  if(x>=0&&x<5)printf("%0.3lf",-1*x+2.5);
  else if(x>=5&&x<10)printf("%0.3lf",2-1.5*(x-3)*(x-3));
  else printf("%0.3lf",x/2-1.5);
  return 0;
}

128.简单算术表达式求值

#include<bits/stdc++.h>
using namespace std;
int main() 
{
	long long a,b;
	char z;
	cin>>a>>z>>b;
	if(int(z)==43) cout<<a+b;
	if(int(z)==45) cout<<a-b;
	if(int(z)==42) cout<<a*b;
	if(int(z)==47) cout<<a/b;
	if(int(z)==37) cout<<a%b;
}

129.计算器(简易版)

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

int main () 
{
	int a,b,s;
	char c;
	cin>>a>>b>>c;
	if (c=='+') cout<<a+b;
	if (c=='-') cout<<a-b;
	if (c=='*') cout<<a*b;
	if (c=='/'&&b!=0) cout<<a/b;
	if (c=='/'&&b==0) cout<<"Error!";
}

130.贪吃的代价

#include <bits/stdc++.h>
using namespace std;
int read()
{
  int s=1,a=0;
  char c=getchar();
  while(!isdigit(c))
  {
    if(c=='-') s=-s;
    c=getchar();
  }
  while(isdigit(c))
  {
    a=a*10+c-'0';
    c=getchar();
  }
  return s*a;
}
int main()
{
  long long n,a,b,k=0,t=0,m;
  bool c=false;
  n=read();
  a=read();
  b=read();
  if(a<b)
  {
    c=true;
    swap(a,b);
  }
  t=n/b;
  m=a-b;
  k=(n-t*b)/m;
  if(k>t) k=t;
  t=t-k;
  if(c==false) cout<<k<<" "<<t;
  else cout<<t<<" "<<k;
  return 0;
}

131.求一元二次方程的根

#include <bits/stdc++.h>
using namespace std;
int main()
{
  double a,b,c,x1,x2;
  cin>>a>>b>>c;
  if(b*b== 4.0 * a * c)printf("x1=x2=%0.5lf",(-1.0*b + sqrt(b*b-4.0*a*c))/(2.0*a));
  else if(b*b > 4.0 * a * c)printf("x1=%0.5lf;x2=%0.5lf",(-1.0*b + sqrt(b*b-4.0*a*c))/(2.0*a),(-1.0*b - sqrt(b*b-4.0*a*c))/(2.0*a));
  else if(b*b<4*a*c)printf("x1=%0.5lf+%0.5lfi;x2=%0.5lf-%0.5lfi",-1.0*b / (2.0*a),sqrt(4.0*a*c-b*b) / (2.0*a),-1.0*b / (2.0*a),sqrt(4.0*a*c-b*b) / (2.0*a));
}

132.基本运算1

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

int main () 
{
	int a;
	cin>>a;
	cout<<a-2;
}

133.基本运算2

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

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

134.基本运算3

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

int main()
{
  int a,n,s;
  cin>>a>>n;
  s=a%(n%2);
  cout<<s<<endl;
  return 0;
}

135.基本运算4

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

int main()
{
  int a,s;
  cin>>a;
  a+=a;
  a-=a;
  a*=a;
  cout<<a<<endl;
  return 0;
}

136.老狼老狼几点了?

#include<bits/stdc++.h>
using namespace std;
int main() 
{
	cout<<"What time is it, old wolf? 1 o'clock."<<endl;
	cout<<"What time is it, old wolf? 2 o'clock."<<endl;
	cout<<"What time is it, old wolf? 3 o'clock."<<endl;
	cout<<"What time is it, old wolf? 4 o'clock."<<endl;
	cout<<"What time is it, old wolf? 5 o'clock."<<endl;
	cout<<"What time is it, old wolf? 6 o'clock."<<endl;
	cout<<"What time is it, old wolf? 7 o'clock."<<endl;
	cout<<"What time is it, old wolf? 8 o'clock."<<endl;
	cout<<"What time is it, old wolf? 9 o'clock."<<endl;
	cout<<"What time is it, old wolf? 10 o'clock."<<endl;
	cout<<"What time is it, old wolf? 11 o'clock."<<endl;
	cout<<"What time is it, old wolf? 12 o'clock.";
}

137.叮叮当当

#include<bits/stdc++.h>
using namespace std;
int main() 
{
	int n,m;
	cin>>n>>m;
	for (int i=n;i<=m;i++)
	{
		if (i%2==0 && i%3==0) cout<<i<<": ding ding,dang dang"<<endl;
		else if (i%2==0) cout<<i<<": ding ding"<<endl;
		else if (i%3==0) cout<<i<<": dang dang"<<endl;
	}	}

138.计算运动消耗量

#include <bits/stdc++.h>
using namespace std;
 
int main ()
{
	int n,x,z;
	cin>>n;
	for (;n>=1;n--)
	{
		cin>>x;
		z=z+x;
	}
	cout<<z;
	return 0;
}

139.ZZQ的难题

#include <bits/stdc++.h>
using namespace std;
 
int main ()
{
	long long  n;
	cin>>n;
	cout<<int(pow(2,n));
	return 0;
}

140.1到n的累加和

#include<bits/stdc++.h>
using namespace std;
int main() 
{
	long long r,d=0;
	cin>>r;
	for(int i=1;i<=r;i++)
	{
		d=d+i;
	}
	cout<<d;
}

141.求阶乘n!

#include <bits/stdc++.h>
using namespace std;
 
int main ()
{
	long long  n,j=1;
	cin>>n;
	if (n!=0)
	{
		for(int i=1;i<=n;i++)
		{
			j=i*j;
		}
		cout<<j;
	}
	else cout<<"1";
	
	return 0;
}

142.小明存钱

#include <bits/stdc++.h>
using namespace std;
 
int main ()
{
	int n,x,z;
	cin>>n;
	for (;n>=1;n--)
	{
		cin>>x;
		z=z+x;
	}	
	cout<<z;
}

143.求平均年龄

#include <bits/stdc++.h>
using namespace std;
 
int main ()
{
	double n,x,z;
	cin>>n;
	for (int i=1;i<=n;i++)
	{
		cin>>x;
		z=z+x;
	}	
	printf("%0.2lf",z*1.0/n);
}

144.财务管理

#include <bits/stdc++.h>
using namespace std;
 
int main ()
{
	double n,x,z;
	for (int i=1;i<=12;i++)
	{
		cin>>x;
		z=z+x;
	}	
	printf("$%0.2lf",z*1.0/12);
}

145.均值

#include <bits/stdc++.h>
using namespace std;
 
int main ()
{
	double n,x,z;
	cin>>n;
	for (int i=1;i<=n;i++)
	{
		cin>>x;
		z=z+x;
	}	
	printf("%0.4lf",z*1.0/n);
}

146.求整数的和与均值

#include <bits/stdc++.h>
using namespace std;
 
int main ()
{
	double n,x,z;
	cin>>n;
	for (int i=1;i<=n;i++)
	{
		cin>>x;
		z=z+x;
	}	
	cout<<z<<" ";
	printf("%0.5lf",z*1.0/n);
}

147.温度转换

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

int main () {
	double s1,s2,z;
	cin>>s1>>s2;
	for(int i=min(s1,s2); i<=max(s1,s2); i=i+2)
	{
		cout<<i<<" ";
		z=9.0*i/5.0+32.0;
		printf("%0.1lf\n",z);
	}
}

148.最高的分数

#include<bits/stdc++.h>
using namespace std;
int main() 
{
	long long r,f[100],d=0;
	cin>>r;
	for(int i=1;i<=r;i++)
	{
		cin>>f[i];
		d=max(d,f[i]);
	}
	cout<<d;
}

149.求最大值和最小值

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

int main () {
	int n,x1,n1,y;
	cin>>n;
	for (int i=1; i<=n; i++) {
		cin>>y;
		x1=max(x1,y);
		n1=min(n1,y);
	}
	cout<<x1<<" "<<n1;
}

150.整数序列的元素最大跨度值

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

int main () {
	long long s1,s2,m=0,n=100000001;
	cin>>s1;
	for(int i=1; i<=s1; i=i+1)
	{
		cin>>s2;
		m=max(s2,m);
		n=min(s2,n);
	}
	cout<<m-n;
}

你拍一,我拍一,不关注的不AC!

PS:第62题原先有误,已现在答案为准!

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值