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 ...
随机推荐
- Ant里面神奇的fork
最近两天一直在处理ant运行java程序的一个问题,用IDE直接运行类里面的main函数一切正常,但用ant跑该函数就报错误,错误的原因是运行ant任务时调用的是AntClasloader,而IDE里 ...
- 4K电视与4K显示器的选择
目前主流的电脑显示器分辨率是1920x1080,也就是常说的FHD标准,不过在智能手机都开始朝2560x1440前进了,PC显示器显然还需要更进一步的强化,下一代的标准就是4K分辨率,也就是Utlra ...
- oracle主从表主外键对应关系
一.首先让我们来了解下什么是主外键? 1.主键:唯一标识数据表中的某一行 1) 一个表中只能有一个主键.如果在其他字段上建立主键,则原来的主键就会取消.在ACCESS中,虽然主键不是必需的,但最好为每 ...
- ADB命令行工具使用
Putty工具连接Android设备 下载链接:https://github.com/sztupy/adbputty/downloads 如上图所示:在HostName中输入transport-usb ...
- PAT 数列求和-加强版 (20分)(简单模拟)
给定某数字A(1≤A≤9)以及非负整数N(0≤N≤100000),求数列之和S=A+AA+AAA+⋯+AA⋯A(N个A).例如A=1, N=3时,S=1+11+111=123 输入格式: 输入数字A与 ...
- C语言基础:分支语句和常见运算符 分类: iOS学习 c语言基础 2015-06-10 21:44 13人阅读 评论(0) 收藏
if(判断条件){ 执行语句; }else if(判断条件){ 执行语句; } switch (整型表达式){ case 值1: 执行语句; break; case 值2: 执行语句; break; ...
- 玩转TypeScript(3)--数组
数组的语法和语义与C#数组非常相似,首先要指定一个数组名,后跟冒号,冒号后面紧跟数组的类型,数组类型名后面跟方括号表示当前定义的是一个数组,对于一个空的数组定义,可以使用如下的语法: btnArray ...
- 微信小程序 按钮点击跳转页面
wx.navigateTo({ url: '/pages/index/talkPage', })跳转到talkPage界面. 首先: html界面要在app.json里面注册: 不注册的话会报 ...
- 【计算机视觉】人脸检测模型的评估方法-linux
前言 人脸检测标准库FDDB详细介绍了数据库和使用方法.对于训练的模型,如何评估模型的效果呢,本文对此进行介绍.说实话,参考了很多博客,但是感觉都不是很明白(当然本文也会有瑕疵),故在此记录! 测试环 ...
- caffe安装编译问题-ImportError: No module named google.protobuf.internal
问题描述 ~/Downloads/caffe$ python Python (default, Dec , ::) [GCC ] on linux2 Type "help", &q ...