zju pat 1058 A+B in Hogwarts

zju pat 1058 A+B in Hogwarts
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
typedef struct GSK
{
    int g;
    int s;
    int k;
};
int main()
{
    char A[100];
    char B[100];
    GSK da;
    GSK db;
    GSK dr;
    int t1,t2,t3;
    while(scanf("%s %s",A,B)!=EOF)
    {
        sscanf(A,"%d.%d.%d",&da.g,&da.s,&da.k);
        sscanf(B,"%d.%d.%d",&db.g,&db.s,&db.k);
        t1 = da.k + db.k;
        t2 = da.s + db.s;
        t3 = da.g + db.g;
        dr.k =  t1 % 29;
        dr.s = (t2 + t1/29) % 17;
        dr.g = (t3 + (t2 + t1/29)/17);
        printf("%d.%d.%d\n",dr.g,dr.s,dr.k);
    }
    return 0;
}
zju pat 1058 A+B in Hogwarts

zju pat 1058 A+B in Hogwarts

上一篇:不算退役贴的退役贴


下一篇:Sicily 4952. Another Rock-Paper-Scissors Problem 解题报告