PAT甲题题解-1058. A+B in Hogwarts (20)-大水题
无语,这种水题还出,浪费时间,但又不得不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; }