题目链接:点击打开链接
知识点笔记:
第一次提交有一个2分的case没有过去,最后发现还是边界问题,g、s、k 和 sum都要用long long类型
AC代码:
#include <iostream>
using namespace std;
typedef long long ll;
int main() {
int Galleon = 17*29;
int Sickle = 29;
ll g,s,k;
scanf("%lld.%lld.%lld",&g,&s,&k);
ll A = g*Galleon+s*Sickle+k;
scanf("%lld.%lld.%lld",&g,&s,&k);
ll B = g*Galleon+s*Sickle+k;
ll sum = A+B;
g=sum/Galleon;
s=sum%Galleon/Sickle;
k=sum%Sickle;
printf("%lld.%lld.%lld",g,s,k);
return 0;
}