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 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
分析:水题,注意可能溢出,用long long保险点
/**
* Copyright(c)
* All rights reserved.
* Author : Mered1th
* Date : 2019-02-24-01.29.25
* Description : A1058
*/
#include<cstdio>
#include<cstring>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<unordered_set>
#include<map>
#include<vector>
#include<set>
using namespace std;
int main(){
#ifdef ONLINE_JUDGE
#else
freopen("1.txt", "r", stdin);
#endif
int b,c;
int e,f;
,i=;
;
scanf("%lld.%d.%d %lld.%d.%d",&a,&b,&c,&d,&e,&f);
i=f+c;
){
i-=;
h++;
}
h=h+b+e;
){
h-=;
g++;
}
g=g+a+d;
printf("%lld.%d.%d",g,h,i);
;
}
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 ...
- 1058 A+B in Hogwarts (20)
#include <stdio.h> int main() { ]; ]; ],&ans1[],&ans1[],&ans2[],&ans2[],&a ...
- PAT (Advanced Level) 1058. A+B in Hogwarts (20)
简单题. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #in ...
- PAT甲题题解-1058. A+B in Hogwarts (20)-大水题
无语,这种水题还出,浪费时间,但又不得不A... #include <iostream> #include <cstdio> #include <algorithm> ...
- 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 ...
随机推荐
- SharePoint Excel Service-PowerShell
1. 创建一个信任的文件路径 New-SPExcelFileLocation -Address "http://sp2010/Excel Workbooks" -ExcelServ ...
- 《头文字D》热门同人插画欣赏
<头文字D>(INITIAL D)是一部以山道飙车为题材的日本青年漫画,以及以漫画改编的动画系列(包含电视版.OVA.与电影版).漫画作者为重野秀一(しげの秀一),自1995 年起开始在讲 ...
- IDC:2014年的十大 IT 趋势
IDC:2014年的十大 IT 趋势 市场研究公司 IDC 近日发布报告,对 2014 年的十大科技行业发展趋势作出了预测.IDC 称,2014 年将是科技业"鏖战正酣"的一年,整 ...
- nodejs 安装出错总结
1.npm无法安装模块,重新安装nodejs之前要 删除node下的文件(主要是npm包,不然安装是徒劳) 2.npm config list -l 查看git配置 3. Downloading bi ...
- NBUT 1217 Dinner 2010辽宁省赛
Time limit 1000 ms Memory limit 32768 kB Little A is one member of ACM team. He had just won the g ...
- CentOS7.5最小化安装与初始化配置(做标准化)
本文分享CentOS的标准化安装配置方法,方便集群批量装机配置 ------------------------- 完美的分割线 ---------------------------- 1.安装标准 ...
- [LeetCode&Python] Problem 136. Single Number
Given a non-empty array of integers, every element appears twice except for one. Find that single on ...
- HDU 2094:产生冠军(拓扑排序)
产生冠军 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submi ...
- Flask第31课——include标签
我们在上一节代码基础上增加一些代码,样式: 文件名index.html,代码: {% from 'macros/forms.html' import input %} <!DOCTYPE htm ...
- android BSP移植综述
将android移植到特定硬件平台上,其核心是bsp的搭建工作,bsp是板级支持包,并不是特定某个文件,而是从功能上理解的一种硬件适配软件包,它的核心就是: 1. linux内核硬件相关部分(主要是l ...