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. 大数据之Flume

    什么是Flume ApacheFlume是一个分布式的.可靠的.可用的系统,用于高效地收集.聚合和将大量来自不同来源的日志数据移动到一个集中的数据存储区. 系统要求 1. JDK 1.8 或以上版本 ...

  2. Openstack部署踩坑

    第一周: 使用kola部署Openstack,vip_address有问题,双网上也不行,就是部署不了,但all-in-one却可以,可是节点不会加. 第二周: 使用Packstack部署Openst ...

  3. Centos7下ELK+Redis日志分析平台的集群环境部署记录

    之前的文档介绍了ELK架构的基础知识,日志集中分析系统的实施方案:- ELK+Redis- ELK+Filebeat - ELK+Filebeat+Redis- ELK+Filebeat+Kafka+ ...

  4. C_数据结构_循环队列

    # include <stdio.h> # include <malloc.h> typedef struct Queue { int * pBase; int front; ...

  5. 个人阅读作业——软件工程M1/M2的总结

    临近学期末,本学期的软件工程课也已经结束了,在此我对软件工程课中,我们团队M1和M2开发阶段中,我做的工作做一个总结 我是DEV,主要工作是等着上级给我分配任务,但是很多时候如果这个活我不干,其他人就 ...

  6. 《Linux内核分析》第七周学习总结

    <Linux内核分析>第七周学习总结                         ——可执行程序的装载 姓名:王玮怡  学号:20135116 一.理论部分总结 (一)可执行程序的装载 ...

  7. Linux内核分析——第四章 进程调度

    第四章 进程调度 4.1 多任务 1.多任务操作系统就是能同时并发的交互执行多个进程的操作系统. 2.多任务操作系统使多个进程处于堵塞或者睡眠状态,实际不被投入执行,这些任务尽管位于内存,但是并不处于 ...

  8. 20135323符运锦期中总结----Linux系统的理解及学习心得

    一.网易云课堂 1.各章节总结 第一周:计算机是如何工作的http://www.cnblogs.com/20135323fuyunjin/p/5222787.html 第二周:操作系统是如何工作的ht ...

  9. jeecg中vaildfrom的复杂的表单校验

    简介 jeecg生成的页面都是使用validfrom组件来确保数据的完整性和准确性. 凡要验证格式的元素均需绑定datatype属性,datatype可选值内置有10类,用来指定不同的验证格式. 如果 ...

  10. Linux 重启网络提示找不到eth0(no device found for “System eth0”)

    一.背景 使用VMWare创建了一个虚拟机(VM1),然后通过拷贝的方式创建了另一台虚拟机(VM2).在第二台虚拟机上设置网卡为固定IP,使用service network restart重启网络的时 ...