PAT_1058. A+B in Hogwarts

来源:互联网 发布:猎聘 JAVA 编程题 编辑:程序博客网 时间:2024/06/05 14:16
////  main.cpp//  PAT_1058. A+B in Hogwarts////  Created by wjq on 17/5/16.//  Copyright © 2017年 wjq. All rights reserved.//#include <iostream>using namespace std;int a,b,c,d,e,f;int main(int argc, const char * argv[]){    scanf("%d.%d.%d %d.%d.%d",&a,&b,&c,&d,&e,&f);    a+=d;b+=e;c+=f;    if(c>28)    {        c%=29;        b++;    }    if(b>16)    {        b%=17;        a++;    }    printf("%d.%d.%d",a,b,c);    return 0;}


简单题

原创粉丝点击