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, 107], 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<cstdio>
#include<iostream>
using namespace std;
int main(){
long long A[], B[] ,c, c1, c2, c3;
scanf("%lld.%lld.%lld %lld.%lld.%lld", &A[], &A[], &A[], &B[], &B[], &B[]);
c = A[] * * + A[] * + A[] + B[] * * + B[] * + B[];
c1 = c / / ;
c2 = (c / ) % ;
c3 = c % ;
printf("%lld.%lld.%lld", c1, c2, c3);
cin >> c;
return ;
}

1、十分简单的进制转换题,两种方法,统一换算成最低位的单位求和,再换算。或者按照加法进位来做。注意最高位的取值达到了10^7,若用第一种方法,可能要使用long long存储。

2、long long 型在输入和输出时为%lld。

A1058. A+B in Hogwarts的更多相关文章

  1. A1058 A+B in Hogwarts (20)(20 分)

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

  2. PAT A1058 A+B in Hogwarts (20)

    AC代码 #include <cstdio> struct Money { long long Galleon, Sicklke, Knut; }A, B, Sum; void init( ...

  3. PAT甲级——A1058 A+B in Hogwarts

    If you are a fan of Harry Potter, you would know the world of magic has its own currency system -- a ...

  4. PAT/进制转换习题集

    B1022. D进制的A+B (20) Description: 输入两个非负10进制整数A和B(<=230-1),输出A+B的D (1 < D <= 10)进制数. Input: ...

  5. PAT题目AC汇总(待补全)

    题目AC汇总 甲级AC PAT A1001 A+B Format (20 分) PAT A1002 A+B for Polynomials(25) PAT A1005 Spell It Right ( ...

  6. PAT甲级题解分类byZlc

    专题一  字符串处理 A1001 Format(20) #include<cstdio> int main () { ]; int a,b,sum; scanf ("%d %d& ...

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

  8. PAT1058:A+B in Hogwarts

    1058. A+B in Hogwarts (20) 时间限制 50 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue If you ...

  9. 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 ha ...

随机推荐

  1. 在 Ionic2 TypeScript 项目中导入第三方 JS 库

    原文发表于我的技术博客 本文分享了在Ionic2 TypeScript 项目中导入第三方 JS 库的方法,供参考. 原文发表于我的技术博客 1. Typings 的方式 因在 TypeScript 中 ...

  2. Webpack 2 视频教程 003 - Webpack 项目初始化

    原文发表于我的技术博客 这是我免费发布的高质量超清「Webpack 2 视频教程」. Webpack 作为目前前端开发必备的框架,Webpack 发布了 2.0 版本,此视频就是基于 2.0 的版本讲 ...

  3. MongoDB副本集(一主一备+仲裁)环境部署-运维操作记录

    MongoDB复制集是一个带有故障转移的主从集群.是从现有的主从模式演变而来,增加了自动故障转移和节点成员自动恢复.MongoDB复制集模式中没有固定的主结点,在启动后,多个服务节点间将自动选举产生一 ...

  4. mysql连接数设置操作(Too many connections)及设置md5值的加密密码

    mysql在使用过程中,发现连接数超了~~~~ [root@linux-node1 ~]# mysql -u glance -h 192.168.1.17 -pEnter password: ERRO ...

  5. UVA - 116 Unidirectional TSP 多段图的最短路 dp

    题意 略 分析 因为字典序最小,所以从后面的列递推,每次对上一列的三个方向的行排序就能确保,数字之和最小DP就完事了 代码 因为有个地方数组名next和里面本身的某个东西冲突了,所以编译错了,后来改成 ...

  6. iOS GCD中级篇 - dispatch_semaphore(信号量)的理解及使用

    理解这个概念之前,先抛出一个问题 问题描述: 假设现在系统有两个空闲资源可以被利用,但同一时间却有三个线程要进行访问,这种情况下,该如何处理呢? 或者 我们要下载很多图片,并发异步进行,每个下载都会开 ...

  7. [2017BUAA软工]第0次博客作业

    第一部分:结缘计算机 1.你为什么选择计算机专业?你认为你的条件如何?和这些博主比呢? 当初选择计算机专业作为自己报考大学的第一志愿,主要是看重了市场对于计算机行业人士的巨大需求,同时也感慨于计算机行 ...

  8. XSS编码与绕过

     XSS编码与绕过 0x00 背景 对于了解web安全的朋友来说,都知道XSS这种漏洞,其危害性不用强调了.一般对于该漏洞的防护有两个思路:一是过滤敏感字符,诸如[<,>,script,' ...

  9. zabbix2.2 - FromDual.MySQL.check" became not supported

    升级zabbix后发现zabbix server日志中多个实例报错如下: 27974:20171227:113001.724 item "实例name:FromDual.MySQL.chec ...

  10. maven手动添加jar包到本地仓库

    推荐几个好的 Maven 常用仓库网址:http://mvnrepository.com/http://search.maven.org/ Maven 安装 JAR 包的命令是: mvn instal ...