您的位置:首页 > 其它

PAT甲题题解-1058. A+B in Hogwarts (20)-大水题

2017-03-06 18:35 399 查看
无语,这种水题还出,浪费时间,但又不得不A。。。

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string.h>
#include <cmath>
#define SICKLE 17
#define KNUT 29
using namespace std;
int a1,a2,a3;
int b1,b2,b3;
int main()
{
scanf("%d.%d.%d %d.%d.%d",&a1,&a2,&a3,&b1,&b2,&b3);
int r1=0,r2=0,r3=0;
r3=a3+b3;
if(r3>=KNUT){
r3-=KNUT;
r2++;
}
r2+=a2+b2;
if(r2>=SICKLE){
r2-=SICKLE;
r1++;
}
r1+=a1+b1;
printf("%d.%d.%d\n",r1,r2,r3);
return 0;
}


View Code
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: