错误点: 输出中间位置应该是temp %(17*29)/ 29而不是temp / 29
#include<iostream>
#include<cstdio>
using namespace std;
int main() {
int a1, b1, c1, a2, b2, c2;
bool flag = false;
scanf("%d.%d.%d", &a1, &b1, &c1);
scanf("%d.%d.%d", &a2, &b2, &c2);
int temp1 = a1 * 17 * 29 + b1 * 29 + c1;
int temp2 = a2 * 17 * 29 + b2 * 29 + c2;
int temp = temp2 - temp1;
if (temp < 0) {
flag = true;
temp = -temp;
}
if (flag) cout << "-";
printf("%d.%d.%d", temp / (17 * 29), temp %(17*29)/ 29, temp % 29);
return 0;
}