1058 A+B in Hogwarts

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,10​7​​], 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()
 {
 	int G,S,K;
 	int Gs=0,Ss=0,Ks=0;
 	for(int i=0;i<2;i++)
 	{
 		scanf("%d.%d.%d",&G,&S,&K);
 		Gs+=G;
 		Ss+=S;
 		Ks+=K;
	 }
	 if(Ks>=29)
	 {
	 	Ss=Ss+Ks/29;
	 	Ks=Ks%29;

	 }
	 if(Ss>=17)
	 {
	 	Gs=Gs+Ss/17;
	 	Ss=Ss%17;

	 }
	 printf("%d.%d.%d",Gs,Ss,Ks);
 	return 0;
 }

PAT甲级——1058 A+B in Hogwarts的更多相关文章

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

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

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

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

  6. PAT甲级题解(慢慢刷中)

    博主欢迎转载,但请给出本文链接,我尊重你,你尊重我,谢谢~http://www.cnblogs.com/chenxiwenruo/p/6102219.html特别不喜欢那些随便转载别人的原创文章又不给 ...

  7. PAT甲级题分类汇编——计算

    本文为PAT甲级分类汇编系列文章. 计算类,指以数学运算为主或为背景的题. 题号 标题 分数 大意 1058 A+B in Hogwarts 20 特殊进制加法 1059 Prime Factors ...

  8. PAT甲级题分类汇编——序言

    今天开个坑,分类整理PAT甲级题目(https://pintia.cn/problem-sets/994805342720868352/problems/type/7)中1051~1100部分.语言是 ...

  9. PAT 甲级真题题解(1-62)

    准备每天刷两题PAT真题.(一句话题解) 1001 A+B Format  模拟输出,注意格式 #include <cstdio> #include <cstring> #in ...

随机推荐

  1. [CISCN 2019 初赛]Love Math

    0x00 知识点 PHP函数: scandir() 函数:返回指定目录中的文件和目录的数组. base_convert() 函数:在任意进制之间转换数字. dechex() 函数:把十进制转换为十六进 ...

  2. python里类的概念

    Python编程中类的概念可以比作是某种类型集合的描述,如"人类"可以被看作一个类,然后用人类这个类定义出每个具体的人--你.我.他等作为其对象.类还拥有属性和功能,属性即类本身的 ...

  3. Delphi生成即调用带窗体的Dll

    library frmDll; { Important note about DLL memory management: ShareMem must be the first unit in you ...

  4. Git 学习 day01

    Tips:最近的工作中需要用到版本控制工具git,所以准备开一个分类用来记录下自己学到的知识,以备以后温习 在安装完git之后需要设置用户名和用户邮箱: $ git config --global u ...

  5. 移动端— Touch事件轮播图

    虽然 以前也写过手机端页面 .当时用的jquery moblie 框架.啥也不懂 就知道复制粘贴出效果 不敢改内部样式.现在呢  了解手机端原理 一些基本的概念 视口 缩放 后 .再去想以前写的页面  ...

  6. APP-计算器

    在网课上学习了计算器的制作方法,并自己做了小常识,看完一便后,感觉自己会了,思想也明白了,但是当关掉视频真正开始做的时候会发向许多的问题,自己在前的好多语法用的并不是很熟练,但是反复的查阅资料,观看教 ...

  7. Dynamics CRM - 为 Form 或者字段设置 Error Notification

    在 Dynamics CRM 开发中,我们一般要利用 JS 来做一些数据验证的功能,我们也需要将验证结果显示出来,比起直接 alert 出信息来提示用户的方式,CRM 提供了更加美观和人性化的方式来通 ...

  8. CentOS8上用Docker部署开源项目Tcloud

    一.安装Docker 1.我是虚拟机装的Centos7,linux 3.10 内核,docker官方说至少3.8以上,建议3.10以上(ubuntu下要linux内核3.8以上) root账户登录,查 ...

  9. Java Keyword Static 学习记录

    Static Java编程思想:一旦将什么东西设为static,数据或方法就不会同那个类的任何对象实例联系到一起. 特点:随着类的加载而加载,随着类的销毁而销毁. 作用:可以修饰成员变量,代码块,方法 ...

  10. Vue2.0权限树组件

    项目使用的饿了么的Element-Ui,权限树使用其树形控件: <el-tree :data="data" ></el-tree> 刚开始没有特殊需求,三级 ...