杭电oj(2000-2005)

35 篇文章 2 订阅

2000

#include<iostream>
using namespace std;
 
int main(){
    char a,b,c,d;
    while(cin>>a>>b>>c){
        if(a>b){
            d = a;
            a = b;
            b = d;
        }
        if(b>c){
            d = b;
            b =c;
            c = d;
        }
        if(a>b){
            d = a;
            a = b;
            b = d;
        }
        cout<<a<<" "<<b<<" "<<c<<endl;
    }
}

2001

#include<iostream>
#include <iomanip>
#include<cmath>
using namespace std;
 
int main(){
    double x1,y1,x2,y2,distence;
    while(cin>>x1>>y1>>x2>>y2){
        distence = sqrt((y2-y1)*(y2-y1)+(x2-x1)*(x2-x1));
        cout<<setiosflags(ios::fixed)<<setprecision(2)<<distence<<endl;
    }
}

2002

#include<iostream>
#define PI 3.1415927
#include<cmath>
#include<iomanip>
using namespace std;
 
int main(){
    double radius,volume;
    while(cin>>radius){
        volume = 4*PI*pow(radius,3)/3;
        cout<<setiosflags(ios::fixed)<<setprecision(3)<<volume<<endl;
    }
}

2003

#include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;

int main()
{
    double a;
    while(cin>>a)
    {
        cout<<setiosflags(ios::fixed)<<setprecision(2)<<fabs(a)<<endl;
    }
    return 0;
}

2004

#include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;

int main()
{
    int a;
    while(cin>>a)
    {
        if(90<=a&&a<=100)
            cout<<"A"<<endl;
        else if(80<=a&&a<=89)
            cout<<"B"<<endl;
        else if(70<=a&&a<=79)
            cout<<"C"<<endl;
        else if(60<=a&&a<=69)
            cout<<"D"<<endl;
        else if(0<=a&&a<=59)
            cout<<"E"<<endl;
        else if(a<0||a>100)
            cout<<"Score is error!"<<endl;
    }
    return 0;
}

 

2005

#include<iostream>
using namespace std;
int main()
{
    int y,m,d;
    while(cin>>y)
    {
        int s=0;
        int mm[12]={31,28,31,30,31,30,31,31,30,31,30,31};
        cin.ignore();
        cin>>m;
        cin.ignore();
        cin>>d;
        if(y%400==0||(y%4==0&&y%100!=0))
            mm[1]++;
        for(int i=0;i<(m-1);i++)
            s=s+mm[i];
        s=s+d;
        cout<<s<<endl;
    }
    return 0;
}

 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值