【PAT-A】1058. A+B in Hogwarts 写题记录

#include <cstdio>
struct man{
	int G; //[0,10^7]
	int S; //[0,17)
	int K; //[0,29)
}A,B;
int main(){
	int count=0;
	scanf("%d.%d.%d",&A.G,&A.S,&A.K); 
	scanf("%d.%d.%d",&B.G,&B.S,&B.K); 
	int TK=(A.K+B.K) % 29;
	count =(A.K+B.K) / 29; 
	int TS= (A.S+B.S+count) %17;
	count = (A.S+B.S+count) / 17;
	int TG=A.G+B.G+count;
	printf("%ld.%d.%d",TG,TS,TK);
}

 

猜你喜欢

转载自blog.csdn.net/weixin_43456345/article/details/85039116
0条评论
添加一条新回复