这题挺简单的,一遍就AC了
#include<iostream>
using namespace std;
int number1[3]; int number2[3];
int result[3] = { 0 };
int main() {
scanf("%d.%d.%d", &number1[0], &number1[1], &number1[2]);
scanf("%d.%d.%d", &number2[0], &number2[1], &number2[2]);
int add;
add = number1[2] + number2[2];
if (add >= 29) {
result[2] = add % 29;
result[1]+=add/29;
}
else result[2] = add;
add = result[1] + number1[1] + number2[1];
if (add >= 17) {
result[1] = add % 17;
result[0] += add / 17;
}
else result[1] = add;
result[0] += number1[0] + number2[0];
printf("%d.%d.%d", result[0], result[1], result[2]);
return 0;
}
|