#include<iostream>
using namespace std;
struct {
long Galleon;
int Sickle;
int Knut;
}money[3];
int main() {
scanf("%lld.%d.%d", &money[0].Galleon, &money[0].Sickle, &money[0].Knut);
scanf("%lld.%d.%d", &money[1].Galleon, &money[1].Sickle, &money[1].Knut);
long sum0 = 0, sum1 = 0,sum;
sum0 = money[0].Galleon * 17 * 29 + money[0].Sickle * 29 + money[0].Knut;
sum1= money[1].Galleon * 17 * 29 + money[1].Sickle * 29 + money[1].Knut;
sum = sum1 - sum0;
if (sum >= 0) {
money[2].Galleon = sum / 493;
money[2].Sickle = (sum - money[2].Galleon * 493) / 29;
money[2].Knut = sum - money[2].Galleon * 493 - money[2].Sickle * 29;
cout << money[2].Galleon <<"."<< money[2].Sickle <<"."<< money[2].Knut;
}
else {
sum = -sum;
money[2].Galleon = sum / 493;
money[2].Sickle = (sum - money[2].Galleon * 493) / 29;
money[2].Knut = sum - money[2].Galleon * 493 - money[2].Sickle * 29;
cout <<"-"<< money[2].Galleon << "." << money[2].Sickle << "." << money[2].Knut;
}
return 0;
}
1037 在霍格沃茨找零钱 (20 分)
最新推荐文章于 2024-11-05 21:58:11 发布