PAT1058. A+B in Hogwarts (20)
#include <iostream> using namespace std; int ag,as,ak; int bg,bs,bk; int cg,cs,ck; int main(){ scanf("%d.%d.%d",&ag,&as,&ak); scanf("%d.%d.%d",&bg,&bs,&bk); int c1=(ak+bk)/29; ck=(ak+bk)%29; int c2=(as+bs+c1)/17; cs=(as+bs+c1)%17; cg=ag+bg+c2; printf("%d.%d.%d",cg,cs,ck); return 0; }