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. MyEclipse WebSphere开发教程:安装和更新WebSphere 6.1, JAX-WS, EJB 3.0(七)

    [周年庆]MyEclipse个人授权 折扣低至冰点!立即开抢>> [MyEclipse最新版下载] MyEclipse支持Java EE技术(如JAX-WS和EJB 3.0),它们以功能包 ...

  2. C#实现Access导入导出Excel

    一.Access从Excel中导入数据 .用到的Excel表的格式及内容 实现 [c-sharp] view plaincopyprint? OleDbConnection con = new Ole ...

  3. 微信小程序插件开发

    小程序插件功能介绍 插件,是可被添加到小程序内直接使用的功能组件.开发者可以像开发小程序一样开发一个插件,供其他小程序使用.同时,小程序开发者可直接在小程序内使用插件,无需重复开发,为用户提供更丰富的 ...

  4. matlab mod()&rem()

    一.介绍rem/mod(X,Y)当X,Y符号相同的时候,这两者一样,当符号不相同的时候才有差别,具体表现在rem结果的符号与被除数相同:mod结果的符号与除数相同 二.例子 >> a=9; ...

  5. hdu1176 dp

    题意:在一条 0 ~ 10 的坐标轴上,在整数点上会掉烙饼,一个人第 0 秒站在坐标 5 处,每秒他能够左右移动一个单位的坐标或不移动,并接住该坐标位置当前时间落下的烙饼,(例如第0秒他在坐标5处,第 ...

  6. SQLite数据库学习小结——native层实现

    1. SQlite概述 SQLite是一款轻量.快速.跨平台的嵌入式数据库,是遵守ACID(注:ACID指数据库事务正确执行的四个基本要素的缩写.包含:原子性(Atomicity).一致性(Consi ...

  7. 使用lua graphql 模块让openresty 支持graphql api

      graphql 是一个很不错的api 查询标准语言,已经有一个lua 的版本支持graphql 项目使用docker&&docker-compose 运行 环境准备 模块安装 lu ...

  8. C语言面试题4

    第二部分:程序代码评价或者找错 1.下面的代码输出是什么,为什么?void foo(void){    unsigned int a = 6;    int b = -20;    (a+b > ...

  9. jwt 的使用

    jwt 是什么 ?   json web token  的 简称,是一种无状态的 认证机制 原理:客户端 向服务器端请求一个 jwt 生成的 token ,这个token 带有 一些信息,下次 客户端 ...

  10. 洛谷1352没有上司的舞会——树型dp

    题目:https://www.luogu.org/problemnew/show/P1352 #include<iostream> #include<cstdio> using ...