当前位置:网站首页>1058 A+B in Hogwarts
1058 A+B in Hogwarts
2022-07-23 09:27:00 【Brosto_ Cloud】
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#include <iostream>
using namespace std;
int main() {
int a1, b1, c1, a2, b2, c2, a, b, c;
scanf("%d.%d.%d %d.%d.%d", &a1, &b1, &c1, &a2, &b2, &c2);
c = (c1 + c2) % 29;
b = ((c1 + c2) / 29 + b1 + b2) % 17;
a = a1 + a2 + ((c1 + c2) / 29 + b1 + b2) / 17;
cout << a << '.' << b << '.' << c;
return 0;
}
边栏推荐
- 使用递归字符串反转和全排列
- pytorch 保存和加载模型
- [FPGA tutorial case 36] communication case 6 - development of FFT Fourier transform based on vivado core and detailed explanation of Verilog input timing configuration, which is verified by MATLAB
- 如何高效系统学习 MySQL?
- 读书笔记:程序员的自我修养---第三章
- 【无标题】
- 2000. 反转单词前缀
- 开发者必看 | DevWeekly 第1期:什么是时间复杂度?
- JDBC工具类
- Go-Excelize API源码阅读(五)—— Close()、NewSheet()
猜你喜欢

【Jailhouse 文章】Virtualization over Multiprocessor System-on-Chip an Enabling Paradigm for...

AIRIOT答疑第5期|如何使用低代码业务流引擎?

读书笔记:程序员的自我修养---第三章

SPSS Chi-Square

A ConvNet for the 2020s 论文阅读

MongoDB的CRUD操作(2)

使用HiFlow场景连接器查看每天处于地区的疫情

【bug 简单处理】

向后量子密码学迁移!美国NIST公布12家合作伙伴

The pit trodden by real people tells you to avoid the 10 mistakes often made in automated testing
随机推荐
Huawei applications have called the checkappupdate interface. Why is there no prompt for version update in the application
General design of SQL user table
AIRIOT答疑第5期|如何使用低代码业务流引擎?
一文带你了解如何用SQL处理周报数据
网站建设开始前要考虑的7个问题
35 year old programmer, early middle-aged crisis
一、buildroot目录结构
向后量子密码学迁移!美国NIST公布12家合作伙伴
一文了解微服务低代码实现方式
基于时频图的音频处理-matlab
La fosse Piétinée par l'homme vous dit d'éviter les 10 erreurs courantes dans les tests automatisés
[MySQL from introduction to proficiency] [advanced chapter] (VII) design an index scheme in index & InnoDB
setup中的props和context
真人踩過的坑,告訴你避免自動化測試常犯的10個錯誤
万物互联时代,看IoT测试如何应对“芯”挑战
Const char* in vs2022 cannot assign char*
微信小程序设置背景图片不显示问题解决方法
2000. reverse word prefix
【FPGA教程案例36】通信案例6——基于vivado核的FFT傅里叶变换开发以及verilog输入时序配置详解,通过matlab进行辅助验证
Understand the box model, and the basic methods of box model's frame, internal and external margins, horizontal layout, vertical layout, setting floating, and dealing with height collapse