【PAT甲级】1058 A+B in Hogwarts (20 分)

题意:

输入两组,每组三个非负整数A,B,C(A<=1e7,B<17,C<29),输出相加的和。(类似个位上29进制,十位上17进制运算)

AAAAAccepted code:

 1 #define HAVE_STRUCT_TIMESPEC
 2 #include<bits/stdc++.h>
 3 using namespace std;
 4 int main(){
 5     ios::sync_with_stdio(false);
 6     cin.tie(NULL);
 7     cout.tie(NULL);
 8     int a,b,c,d,e,f;
 9     char s,ss,sss,ssss;
10     cin>>a;
11     cin>>s;
12     cin>>b;
13     cin>>ss;
14     cin>>c;
15     cin>>d;
16     cin>>sss;
17     cin>>e;
18     cin>>ssss;
19     cin>>f;
20     int x=c+f,y=b+e,z=a+d;
21     if(x>28)
22         x-=29,++y;
23     if(y>16)
24         y-=17,++z;
25     cout<<z<<"."<<y<<"."<<x;
26     return 0;
27 }
保持热爱 不懈努力 不试试看怎么知道会失败呢(划掉) 世上无难事 只要肯放弃(划掉)
原文地址:https://www.cnblogs.com/ldudxy/p/11679143.html