您的位置:首页 > 其它

1058. A+B in Hogwarts (20):有疑惑-第三个测试点错误

2015-08-31 16:23 218 查看
也考虑到数据的区间越界问题了···

#include<iostream>
#include<cstring>
#include<map>
#include<string>
#include<cmath>
#include<algorithm>
using namespace std;

int main()
{
    int P_G, P_S, P_K;
    int A_G, A_S, A_K;
    char c;
    while(cin>>P_G>>c>>P_S>>c>>P_K)
    {
        cin>>A_G>>c>>A_S>>c>>A_K;

        long long P_Sum = P_G*17*29 + P_S*29 + P_K;
        long long A_Sum = A_G*17*29 + A_S*29 + A_K;
        int K = ( P_Sum + A_Sum )%29;
        int S = (( P_Sum + A_Sum )/29)%17;
        int G = (( P_Sum + A_Sum )/29)/17;

        cout<<G<<'.'<<S<<'.'<<K<<endl;
    }
    return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: