hdoj 2004 a小于0的情况也要考虑 2005闰年标志 2006

#include
#include
#include
#include
using namespace std;
int main(){
int a;
while (scanf("%d",&a)!=EOF) {
if(a>100||a<0){
printf(“Score is error!\n”);
}

    else{
        if(a>=90&&a<=100){
            printf("A\n");
        }
        if (a>=80&&a<=89){
            printf("B\n");
        }
        if (a>=70&&a<=79){
            printf("C\n");
        }
        if(a>=60&&a<=69){
            printf("D\n");
        }
        if(a>=0&&a<=59){
            printf("E\n");
        }
    }
}

return 0;

}
/*
90~100为A;
80~89为B;
70~79为C;
60~69为D;
0~59为E;
*/
#include
#include
#include
#include
using namespace std;
int main(){
int data[2][13]={
{0,31,29,31,30,31,30,31,31,30,31,30,31},//闰年
{0,31,28,31,30,31,30,31,31,30,31,30,31}
};
int year,month,day;
while(scanf("%d/%d/%d",&year,&month,&day)!=EOF){
int count=0;
if ((year%100!=0)&&(year%40)||(year%4000)) {
for(int i=1;i count+=data[0][i];
}
count+=day;
}
else{
for(int i=1;i count+=data[1][i];
}
count+=day;
}
printf("%d\n",count);
}

return 0;

}

#include
#include
#include
#include
using namespace std;
int main(){
int n;
scanf("%d",&n);
int ah,am,as,bh,bm,bs;

while (n--) {
    int sumh=0,summ=0,sums=0;
    scanf("%d %d %d %d %d %d",&ah,&am,&as,&bh,&bm,&bs);
    sums=as+bs;
    while(sums>=60) {
        sums-=60;
        summ++;
    }
    summ+=am+bm;
    while(summ>=60) {
        summ-=60;
        sumh++;
    }
    sumh+=ah+bh;
    
    printf("%d %d %d\n",sumh,summ,sums);
}

}

你可能感兴趣的:(acm)