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,10​7​​], 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

分析:水题,注意可能溢出,用long long保险点
 /**
 * Copyright(c)
 * All rights reserved.
 * Author : Mered1th
 * Date : 2019-02-24-01.29.25
 * Description : A1058
 */
 #include<cstdio>
 #include<cstring>
 #include<iostream>
 #include<cmath>
 #include<algorithm>
 #include<string>
 #include<unordered_set>
 #include<map>
 #include<vector>
 #include<set>
 using namespace std;

 int main(){
 #ifdef ONLINE_JUDGE
 #else
     freopen("1.txt", "r", stdin);
 #endif
     int b,c;
     int e,f;
     ,i=;
     ;
     scanf("%lld.%d.%d %lld.%d.%d",&a,&b,&c,&d,&e,&f);
     i=f+c;
     ){
         i-=;
         h++;
     }
     h=h+b+e;
     ){
         h-=;
         g++;
     }
     g=g+a+d;
     printf("%lld.%d.%d",g,h,i);
     ;
 }


1058 A+B in Hogwarts (20 分)的更多相关文章

  1. PAT 甲级 1058 A+B in Hogwarts (20 分) (简单题)

    1058 A+B in Hogwarts (20 分)   If you are a fan of Harry Potter, you would know the world of magic ha ...

  2. 1058 A+B in Hogwarts (20分)

    1058 A+B in Hogwarts (20分) 题目: If you are a fan of Harry Potter, you would know the world of magic h ...

  3. PAT Advanced 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 -- a ...

  4. 【PAT甲级】1058 A+B in Hogwarts (20 分)

    题意: 输入两组,每组三个非负整数A,B,C(A<=1e7,B<17,C<29),输出相加的和.(类似个位上29进制,十位上17进制运算) AAAAAccepted code: #d ...

  5. 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 -- a ...

  6. 1058 A+B in Hogwarts (20)

    #include <stdio.h> int main() { ]; ]; ],&ans1[],&ans1[],&ans2[],&ans2[],&a ...

  7. PAT (Advanced Level) 1058. A+B in Hogwarts (20)

    简单题. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #in ...

  8. PAT甲题题解-1058. A+B in Hogwarts (20)-大水题

    无语,这种水题还出,浪费时间,但又不得不A... #include <iostream> #include <cstdio> #include <algorithm> ...

  9. pat 1058 A+B in Hogwarts(20 分)

    1058 A+B in Hogwarts(20 分) If you are a fan of Harry Potter, you would know the world of magic has i ...

随机推荐

  1. L1-014 简单题

    这次真的没骗你 —— 这道超级简单的题目没有任何输入. 你只需要在一行中输出事实:This is a simple problem. 就可以了. 输入样例: 无 输出样例: This is a sim ...

  2. 不挣扎了,MVC验证错误信息汇总是酱紫的

    public static string GetModelErros(this ModelStateDictionary dic) { var sb = new StringBuilder(); va ...

  3. avalon 路由问题

    1, 直接使用avalon的 amd加载器, 可以不需要 require.js 2, 配置baseUrl 路径, 这个一定要在 js所在的目录,  而不是jsp所在的目录,  如果js 和jsp分开 ...

  4. C++语言的一些问题

    论坛上看到的有人提出的关于C++的一些问题,真是细致(下面还有回复说他对C++一知半解的),一直以为自己的C++还是可以的,可是看了之后真是内牛满面,为什么自己从来没有想的这么深入,差距真的有这么大吗 ...

  5. 添加react-router

    1.index.js 内容: import React from 'react' import ReactDOM from 'react-dom' import { renderRoutes } fr ...

  6. ES6 Generator 学习笔记一

    Generator 函数是 ES6 提供的一种异步编程解决方案,语法行为与传统函数完全不同. Generator 函数有多种理解角度.从语法上,首先可以把它理解成,Generator 函数是一个状态机 ...

  7. 【opencv基础】测量运行时间的函数getTickCount/getCPUTickCount/getTickFrequency

    函数的计算结果类型是double,单位是秒. 要使用更精确的计时,就需要使用getCPUTickCount(),不过现代计算机CPU的频率会随着负载而变化所以没大有必要使用该函数,可以参看函数的介绍[ ...

  8. jqprint 打印分页

    再要分页的结尾处加上<div style="page-break-after:always;"></div> 就可以了

  9. 判断手机端还是pc端

    public static bool CheckIsMobile() { bool flag = false; string agent = SystemWeb.HttpContext.Current ...

  10. 10款PHP开源网店系统

    在当今经济危机的大环境下,网上购物越来越来吃香,网上开店成本低,快捷方便,出名的电子商务网站有淘宝,拍拍,Ebay或是最新的百度有啊,这些网站都提供开店的机会,如果是想自己搭建购物平台,可以从下面选择 ...