Open judge程序设计A_分支结构

#include <bits/stdc++.h>
using namespace std;
int main()
{ double x,z;
  cin>>x;
  if(0<=x&&x<=240)
     z=x*0.4883;
  if(241<=x&&x<=400)
     z=0.4883*240+(x-240)*0.5383;
  if(400<x)
     z=0.4883*240+(400-240)*0.5383+0.7883*(x-400);
  cout<<fixed<<setprecision(2)<<z;
}

 

#include <bits/stdc++.h>
using namespace std;
int main()
{ double z;
  int x;
  cin>>x;
  if(0<=x&&x<=5)
     z=x*2;
  if(6<=x&&x<=10)
     z=x*1.9;
  if(11<=x&&x<=15)
     z=1.8*x;
  if(16<=x&&x<=20)
     z=1.7*x;
  if(20<x)
     z=1.6*x;
  cout<<fixed<<setprecision(2)<<z;
}

 

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

#include <bits/stdc++.h>

using namespace std;

int main()
{   int paishu;
    char shenqing,pai;
    cin>>paishu>>shenqing>>pai;
    if(paishu>=10){
        if(shenqing=='J')
            cout<<"Z"<<endl;
        else if(shenqing=='H')
            cout<<"pass"<<endl;}
    else if(paishu<10){
        if(pai=='D')
            cout<<"D"<<endl;
        else if(pai=='S')
            cout<<"S"<<endl;}



    return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main()
{   float a;
cin>>a;
if(a>=0)
    a=a;
else
    a=-a;



    cout<<fixed<<setprecision(2)<<a<<endl;
}

 

#include <bits/stdc++.h>

using namespace std;

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



}

 

#include <bits/stdc++.h>

using namespace std;

int main()
{   int N;
cin>>N;
if(N>0)
    cout<<"positive";
else
    if(N==0)
    cout<<"zero";
    else if(N<0)
    cout<<"negative";


}

 

#include <bits/stdc++.h>

using namespace std;

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

}

#include <bits/stdc++.h>

using namespace std;

int main()
{   int b;
    char a;

    a=getchar();
    b=a;
    if(b%2==0)
        cout<<"NO";
    else cout<<"YES";

    return 0;
}

 

#include <bits/stdc++.h>

using namespace std;

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

#include <bits/stdc++.h>

using namespace std;

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

}

#include <bits/stdc++.h>

using namespace std;

int main()
{
    double a;
    cin>>a;
    if(a/1.2<(a/3.0+50))
        cout<<"Walk";
    else if(a/1.2>(a/3.0+50))
        cout<<"Bike";
    else if(a/1.2==(a/3.0+50))
        cout<<"All";
}

#include <bits/stdc++.h>

using namespace std;

int main()
{
    double N,x;
    cin>>N;
    x=N;
    if(x>=0&&x<5)
        cout<<fixed<<setprecision(3)<<-x+2.5;
    else if(x>=5&&x<10)
        cout<<fixed<<setprecision(3)<<2-1.5*(x-3)*(x-3);
    else if(x>=10&&x<20)
        cout<<fixed<<setprecision(3)<<x/2.0-1.5;
}

 

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int a;
    char b;
    cin>>a>>b;
    if(a<=1000){if(a<=1000&&b=='n')
        cout<<"8";
    if(a<=1000&&b=='y')
        cout<<"13";}
    else {if(b=='n')
        cout<<ceil((a-1000)/500.0)*4+8;
    else if(b=='y')
        cout<<ceil((a-1000)/500.0)*4+8+5;}
}

 

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    if(a+b>c&&a+c>b&&b+c>a)
        cout<<"yes";
    else cout<<"no";

}

#include <iostream>

using namespace std;

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

    else cout<<"N";

 

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int a,b;
    char c;
    cin>>a>>b>>c;
     if(c!='+'&&c!='-'&&c!='*'&&c!='/')
        cout<<"Invalid operator!";
    else {
    if(c=='+')cout<<a+b;
    else if(c=='-')cout<<a-b;
    else if(c=='*')cout<<a*b;
    else if(c=='/'){
            if(b==0)
            cout<<"Divided by zero!";
            else cout<<a/b;}

    }

}

相关推荐

OpenJudge - NOI - 首页http://noi.openjudge.cn/

  • 5
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

亖嘁

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值