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 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 Bare 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 <iostream>
- #include <algorithm>
- #include <cstdio>
- #include <cstring>
- #include <map>
- #include <stack>
- #include <vector>
- #include <queue>
- #include <set>
- #define LL long long
- using namespace std;
- const int MAX = 1e7 + ;
- int a1, a2, b1, b2, c1, c2, ans1 = , ans2 = , ans3 = , b = ;
- int main()
- {
- // freopen("Date1.txt", "r", stdin);
- scanf("%d.%d.%d %d.%d.%d", &a1, &b1, &c1, &a2, &b2, &c2);
- ans3 += (c1 + c2) % , b = (c1 + c2) / ;
- ans2 += (b + b1 + b2) % , b = (b + b1 + b2) / ;
- ans1 += b + a1 + a2;
- printf("%d.%d.%d\n", ans1, ans2, ans3);
- return ;
- }
pat 1058 A+B in Hogwarts(20 分)的更多相关文章
- 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 ...
- 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 ...
- 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 ...
- 【PAT甲级】1058 A+B in Hogwarts (20 分)
题意: 输入两组,每组三个非负整数A,B,C(A<=1e7,B<17,C<29),输出相加的和.(类似个位上29进制,十位上17进制运算) AAAAAccepted code: #d ...
- 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 ...
- PAT (Advanced Level) Practice 1035 Password (20 分) 凌宸1642
PAT (Advanced Level) Practice 1035 Password (20 分) 凌宸1642 题目描述: To prepare for PAT, the judge someti ...
- PAT (Advanced Level) Practice 1008 Elevator (20 分) 凌宸1642
PAT (Advanced Level) Practice 1008 Elevator (20 分) 凌宸1642 题目描述: The highest building in our city has ...
- PAT甲级:1152 Google Recruitment (20分)
PAT甲级:1152 Google Recruitment (20分) 题干 In July 2004, Google posted on a giant billboard along Highwa ...
- PAT乙级:1072开学寄语(20分)
PAT乙级:1072开学寄语(20分) 题干 下图是上海某校的新学期开学寄语:天将降大任于斯人也,必先删其微博,卸其 QQ,封其电脑,夺其手机,收其 ipad,断其 wifi,使其百无聊赖,然后,净面 ...
- PAT乙级:1057 数零壹 (20分)
PAT乙级:1057 数零壹 (20分) 题干 给定一串长度不超过 105 的字符串,本题要求你将其中所有英文字母的序号(字母 a-z 对应序号 1-26,不分大小写)相加,得到整数 N,然后再分析一 ...
随机推荐
- [Luogu4447] [AHOI2018初中组]分组
题目描述 小可可的学校信息组总共有n 个队员,每个人都有一个实力值a[i]a[i]a[i].现在,一年一度的编程大赛就要到了,小可可的学校获得了若干个参赛名额,教练决定把学校信息组的nnn 个队员分成 ...
- 为什么重写equals必须重写hoshCode的基础分析
为什么重写equals必须重写hoshCode的基础分析 1.我们先来了解下原生的equals和hashCode代码 原生equals:它判断的是两个对象是否相等 原生hashCode值:它是根据内存 ...
- JavaScript ES6函数式编程(三):函子
前面二篇学习了函数式编程的基本概念和常见用法.今天,我们来学习函数式编程的最后一个概念--函子(Functor). 相信有一部分同学对这个概念很陌生,毕竟现在已经有很多成熟的轮子,基本能满足我们日常的 ...
- 使用Redis在Hibernate中进行缓存
Hibernate是Java编程语言的开放源代码,对象/关系映射框架.Hibernate的目标是帮助开发人员摆脱许多繁琐的手动数据处理任务.Hibernate能够在Java类和数据库表之间以及Java ...
- Rancher 2.3.2 Stable!Istio UI已经GA!生产可用!
2019年10月9日,Rancher 2.3正式发布,这是Rancher Labs迄今为止最重要的产品版本.Rancher 2.3是业界首个GA支持Windows容器的Kubernetes管理平台,并 ...
- scp -本地文件上传服务器,指定端口
scp 命令可以将本地文件上传服务器,或者将服务器上的文件下载到本地, 1. 上传服务器: scp [本地文件目录] [服务器用户名]@[服务器名]:/[服务器上文件路径] 比如 scp /Doc ...
- linux端口查询
常用端口 下面的表格中列举了包括在红帽企业 Linux 中的服务.守护进程.和程序所使用的最常见的通信端口.该列表还可以在 /etc/services 文件中找到.要查看由互联网号码分派局(IANA) ...
- SpringCloud之整合Zipkin+Sleuth(十四)
1.添加依赖 在项目的pom.xml文件中添加下面依赖 <!--里面包含两个依赖--> <dependency> <groupId>org.springframew ...
- Spring的几种初始化和销毁方法
一 指定初始化和销毁方法 通过@Bean指定init-method和destroy-method: @Bean(initMethod="init",destroyMethod=&q ...
- 我的第一个Python爬虫——谈心得
2019年3月27日,继开学到现在以来,开了软件工程和信息系统设计,想来想去也没什么好的题目,干脆就想弄一个实用点的,于是产生了做“学生服务系统”想法.相信各大高校应该都有本校APP或超级课程表之类的 ...