1037 在霍格沃茨找零钱 (20分)
跟时间小时分钟题的进制转换大体一样,模拟一下
#include<iostream>
#include<cstdio>
const int Galleon=17*29;
const int Sickle=29;
using namespace std;
int main(){
int p1,p2,p3,a1,a2,a3;
scanf("%d.%d.%d %d.%d.%d",&p1,&p2,&p3,&a1,&a2,&a3);
int price=p1*Galleon+p2*Sickle+p3;
int money=a1*Galleon+a2*Sickle+a3;
int change=money-price;
if(change<0){
cout<<"-";
change=-change;
}
printf("%d.%d.%d",change/Galleon,change%Galleon/Sickle,change%Sickle);
return 0;
}