首页 > 其他 > 详细

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

时间:2019-10-15 18:17:49      阅读:79      评论:0      收藏:0      [点我收藏+]

题意:

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

代码:

#define HAVE_STRUCT_TIMESPEC
#include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int a,b,c,d,e,f;
char s,ss,sss,ssss;
cin>>a;
cin>>s;
cin>>b;
cin>>ss;
cin>>c;
cin>>d;
cin>>sss;
cin>>e;
cin>>ssss;
cin>>f;
int x=c+f,y=b+e,z=a+d;
if(x>28)
x-=29,++y;
if(y>16)
y-=17,++z;
cout<<z<<"."<<y<<"."<<x;
return 0;
}

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

原文:https://www.cnblogs.com/ldudxy/p/11679143.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!