PAT A1058 A+B in Hogwarts

水题,没什么可说的;

#include<stdio.h>
#include<stdlib.h>
#include<vector>
#include<iostream>
using namespace std;
using std::vector;
int main(){
    //1-17-29
    int G1,G2,S1,S2,K1,K2;
    scanf("%d.%d.%d%d.%d.%d",&G1,&S1,&K1,&G2,&S2,&K2);
    if(K1+K2>=29){
        K1=K1+K2-29;
        S1++;
    }else{
        K1=K1+K2;
    }
    if(S1+S2>=17){
        S1=S1+S2-17;
        G1++;
    }else{
        S1=S1+S2;
    }
    G1=G1+G2;
    printf("%d.%d.%d",G1,S1,K1);
    system("pause");
    return 0;
}

 

相关文章: