思路就是将画的钱和拥有的钱全换算成最小的单位,之后直接相减,最后输出的时候按照相应的进制输出就OK.
#include "iostream"
#include "string"
#include "algorithm"
#include "stdio.h"
#include "vector"
using namespace std;
int main()
{
int g1,s1,k1;
int g2,s2,k2;
int num1,num2;
long result;
bool flag;
scanf("%d.%d.%d",&g1,&s1,&k1);
scanf("%d.%d.%d",&g2,&s2,&k2);
num1 = k1+s1*29+g1*493;
num2 = k2+s2*29+g2*493;
if(num2>num1)
{
flag = 0;
result = num2- num1;
}
else
{
flag = 1;
result = num1- num2;
}
if(flag == 1)
cout<<"-";
cout<<result/493<<".";
result= result % 493;
cout<<result/29<<".";
result= result % 29;
cout<<result;
return 0;
}