PAT 1058. A+B in Hogwarts
来源:互联网 发布:php 500错误日志 编辑:程序博客网 时间:2024/06/04 23:34
只想说scanf的强大
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.27Sample Output:
14.1.28
#include <cstdio>using namespace std;int a1, b1, c1, a2, b2, c2;int main(){ scanf("%d.%d.%d %d.%d.%d", &a1, &b1, &c1, &a2, &b2, &c2); int a, b , c; c = (c1 + c2) % 29; b = ((c1 + c2) / 29 + b1 + b2) % 17; a = ((c1 + c2) / 29 + b1 + b2) / 17 + a1 + a2; printf("%d.%d.%d", a, b, c); return 0;}
- PAT-A 1058. A+B in Hogwarts
- 1058. A+B in Hogwarts (20)- PAT
- 【PAT】1058. A+B in Hogwarts (20)
- PAT 1058. A+B in Hogwarts (20)
- PAT 1058. A+B in Hogwarts (20)
- pat 1058. A+B in Hogwarts (20)
- PAT 1058. A+B in Hogwarts (20)
- PAT 1058. A+B in Hogwarts (20)
- PAT 1058. A+B in Hogwarts
- 【PAT】1058. A+B in Hogwarts
- PAT---1058. A+B in Hogwarts (20)
- PAT A 1058. A+B in Hogwarts (20)
- PAT(A) - 1058. A+B in Hogwarts (20)
- PAT-A 1058. A+B in Hogwarts (20)
- PAT-A-1058. A+B in Hogwarts (20)
- 浙大PAT 1058题 1058. A+B in Hogwarts
- 【c++】PAT(advanced level)1058. A+B in Hogwarts (20)
- 【PAT (Advanced Level)】1058. A+B in Hogwarts (20)
- Spring学习笔记 —— 从IOC说起
- [HDU 5558] Alice's Classified Message (后缀数组+LCP+单调栈)
- CentOS 配置SSH免密码登陆
- 13 款免费但好用到哭的项目管理工具
- Outlook外网邮件用内网邮箱转发
- PAT 1058. A+B in Hogwarts
- CentOS7.1 安装 ffmepg
- Intel Code Challenge Final Round C.Ray Tracing
- 如何高效学习oracle数据库浅谈之一
- BZOJ 2743 [HEOI2012]采花
- 多线程和多进程模型的选用
- 阿里云发布视频云解决方案ApsaraVideo 打造直播界的“宜家”
- 欢迎使用CSDN-markdown编辑器
- 2016/10/12