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. Git push 时如何避免出现 "Merge branch 'master' of ..."

    在使用 Git 的进行代码版本控制的时候,往往会发现在 log 中出现 "Merge branch 'master' of ..." 这句话,如下图所示.日志中记录的一般为开发过程 ...

  2. 关于树莓派HDMI转VGA线接显示器黑屏

    经过数种折腾,找到了解决方法,在SD卡内有个config.txt文件,在其中找到“#hdmi_safe=1”,把#消除掉,变更后成为 # uncomment if you get no picture ...

  3. Unity 敌人波次设计

    一.平均时间随机敌人 将所有种类敌人预制物体放在一个列表里面,每隔时间T从列表中随机选出一个生成在场景中. 二.时间加权紧迫度随机敌人 在随机情况下每种敌人出现的概率近似相等,当敌人种类较多时,有可能 ...

  4. 线上mongodb 数据库用户到期时间修改的操作记录

    登陆版权数据库,显示"此用户已到期",数据库使用的是mongodb,顾 需要将此用户的到期时间延长. 解决过程: 1)到网站对应tomcat配置里找出等里mongodb的信息(mo ...

  5. 四则运算生成器功能完善&&界面设计——结对项目

    结对成员:何小松 && 李入云 一.对结对编程的认识 优点: 1)程序员互相帮助,互相教对方,可以得到能力上的互补. 2)可以让编程环境有效地贯彻Design. 3)增强代码和产品质量 ...

  6. MyBatis中if,where,set标签

    <if>标签 <select id="findActiveBlogWithTitleLike" resultType="Blog"> S ...

  7. 第三个Sprint ------第四天

    出题代码 package com.app.senior_calculator; import java.io.Serializable; public class Question implement ...

  8. HDU 2081 手机短号

    Problem Description 大家都知道,手机号是一个11位长的数字串,同时,作为学生,还可以申请加入校园网,如果加入成功,你将另外拥有一个短号.假设所有的短号都是是 6+手机号的后5位,比 ...

  9. Jmeter 发测试报告到邮箱,expand/collapse 图片不显示

    由于发送到邮箱中html文件是不包含expand/collapse 资源文件的,所以导致邮箱中这两个图片没有显示,解决方法有两种: 1. 使用http能访问的图片链接地址 修改change中的图片资源 ...

  10. 【转帖】互联网加密及OpenSSL介绍和简单使用

    转帖:https://mritd.me/2016/07/02/%E4%BA%92%E8%81%94%E7%BD%91%E5%8A%A0%E5%AF%86%E5%8F%8AOpenSSL%E4%BB%8 ...