• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
村雨sup
自己选的路,跪着也要走完 XD
博客园    首页    新随笔    联系   管理    订阅  订阅
PAT 1058 A+B in Hogwarts
1058 A+B in Hogwarts (20 分)
 

If you are a fan of Harry Potter, you would know the world of magic has its own currency system -- as Hagrid explained it to Harry, "Seventeen silver Sickles to a Galleon and twenty-nine Knuts to a Sickle, it's easy enough." Your job is to write a program to compute A+B where A and B are given in the standard form of Galleon.Sickle.Knut (Galleon is an integer in [0], Sickle is an integer in [0, 17), and Knut is an integer in [0, 29)).

Input Specification:

Each input file contains one test case which occupies a line with A and B in the standard form, separated by one space.

Output Specification:

For each test case you should output the sum of A and B in one line, with the same format as the input.

Sample Input:

3.2.1 10.16.27

Sample Output:

14.1.28

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;



int main(){
    int a,b,c,d,e,f;
    scanf("%d.%d.%d",&a,&b,&c);
    scanf("%d.%d.%d",&d,&e,&f);

    int jin1 = (c+f)/29;
    int z = (c+f)%29;

    int jin2 = (b+e+jin1)/17;
    int y = (b+e+jin1)%17;

    ll x = (a+d+jin2)%(1000000000);

    printf("%lld.%d.%d\n",x,y,z);
    return 0;
}

10^7取膜,居然过不了一个数据点,很迷,数据范围不是0-10^7么

posted on 2019-04-19 17:18  村雨sup  阅读(219)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3