1058 A+B in Hogwarts (20 分)
Ideas
The base conversion still has to look at the division and remainder.
There is a pit, carry, need to add carry item
Code
#include <bits/stdc++.h>
using namespace std;
int main()
{
int in1[3];
int in2[3];
scanf("%d.%d.%d",&in1[0],&in1[1],&in1[2]);
scanf("%d.%d.%d",&in2[0],&in2[1],&in2[2]);
int out[3]={
0};
out[2] = (in1[2]+in2[2])%29;
out[1] = (in1[1]+in2[1]+(in1[2]+in2[2])/29)%17; #加上carry项
out[0]= in1[0]+in2[0] + (in1[1]+in2[1]+(in1[2]+in2[2])/29)/17;
printf("%d.%d.%d",out[0],out[1],out[2]);
}