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,然后再分析一 ...
 
随机推荐
- [Luogu3554] Poi2013 Triumphal arch
			
Description Foreseeable和拿破仑的御用建筑师让·夏格伦在玩游戏 让·夏格伦会玩一个叫“凯旋门”的游戏:现在有一棵n个节点的树,表示一个国家 1号点代表这个国家的首都 这个游戏由两 ...
 - libevent::事件::定时器
			
#include <cstdio> #include <errno.h> #include <sys/types.h> #include <event.h&g ...
 - L2-007. 家庭房产(并查集)
			
#include <cstdio> #include <set> #include <vector> #include <algorithm> usin ...
 - MySQL 分页查询优化——延迟关联优化
			
目录 1. InnoDB表的索引的几个概念 2. 覆盖索引和回表 3. 分页查询 4. 延迟关联优化 写在前面 下面的介绍均是在选用MySQL数据库和Innodb引擎的基础开展.我们先 ...
 - CasperJS 前端功能测试
			
CasperJS 是一个开源的导航脚本和测试组件.它提供实用的高级函数.方法和语法糖,可完成以下任务: 对浏览导航步骤的定义和排序 填写和提交表单 点击和跟踪链接 获取页面快照(或者页面中的某部分) ...
 - 探究JavaScript闭包
			
什么是JavaScript闭包? 刚开始知道这个词,就误以为是自动执行的匿名函数块. 比如说+function(){}(); 然而并不是,那么请看下面的例子: function init() { va ...
 - Hadoop 在 windows 7 64位的配置(二)|非cygwin
			
第一次使用需要 hdfs namenode -format 一键启动和关闭hadoop 新建文本文档 然后改名 start-hadoop.cmd 里面的内容 @echo off cd /d %HADO ...
 - unity 内置shader
			
几个有用的Unity 内置shader: (一)Standard RenderingMode:Opaque为实体渲染,更改Color的透明通道不会有影响:Cutout会把图片的透明通道显示出来,非严格 ...
 - CSAPP:代码优化【矩阵读写】
			
转载请注明出处:https://www.cnblogs.com/ustca/p/11790314.html 写程序最主要的目标就是使它在所有可能的情况下都正确工作,另一方面,在很多情况下,让程序运行得 ...
 - 如何在sprintf函数中输出百分号(%)等特殊符号
			
php中的sprinf可以格式化字符串的数据类型.今天遇到了想在其中输出%,可难倒我了. $query = sprintf("select * from books where %s li ...