1037 在霍格沃茨找零钱

水题。

#include<iostream>
#include<algorithm>
using namespace std;

typedef long long LL;
int main() {
    LL G1,S1,K1,G2,S2,K2;
    scanf("%lld.%lld.%lld %lld.%lld.%lld",&G1,&S1,&K1,&G2,&S2,&K2);
    K1 += S1*29+G1*17*29;
    K2 += S2*29+G2*17*29;
    if(K1 > K2) {
        cout<<"-";
        swap(K1,K2);
    }
    LL t = K2-K1;
    printf("%lld.%lld.%lld",t/(17*29),t%(17*29)/29,t%29);
    return 0;
}

 

posted @ 2020-02-19 12:10  tangq123  阅读(76)  评论(0编辑  收藏  举报