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 twentynine 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
 点赞
 写回答
 关注问题
 收藏
 复制链接分享
 邀请回答
2条回答

采纳
点赞 1 评论 复制链接分享
 采纳
相关推荐
 4年前回答 2 已采纳 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 twentynine 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
 回答 2 已采纳 问题描述 : After defeating the Voldemort, Harry is enjoying his senior year in Hogwarts with his friends. They decide to make a graduation trip, using their newest magical broom. In the journey, Harry is trapped in a Kingdom named Binary Kingdom, maybe because the smart but isolated people still have no idea of the great reputation of this young wizard. Loving numbers and binary very much, the subjects of Binary Kingdom claim only Harry solve the problem can he leave there. Harry Potter and J.K.Rowling The problem begins with an empty number multiset, with six kinds of operation: 1. INS M: insert M into the set 2. DEL M: delete all numbers equal to M if any one exists; otherwise report “Del error” 3. ADD M: increase the value of every number by M 4. SUB M: decrease the value of every number by M if after decreasing no number will be less than zero; otherwise report “Sub error” 5. QNUM M: query how many numbers equal to M in the set 6. QBIT M: query how many numbers whose Mth bit is 1 in its binary, M is counting from lower to higher, beginning with 0 Though our brave Harry Potter can proficient in many fields, he is not good at math, now, it’s your time. 输入: The first line contains a single integer T, indicating the number of test cases. Each test case begins with an integer M, following M operations. Technical Specification 1. 1 <= T <= 12 2. 1 <= M <= 100 000 3. The QBIT operations’ M will in the range [0, 17], the other five operations’ M in the range [0, 1 000 000 000]. 输出: The first line contains a single integer T, indicating the number of test cases. Each test case begins with an integer M, following M operations. Technical Specification 1. 1 <= T <= 12 2. 1 <= M <= 100 000 3. The QBIT operations’ M will in the range [0, 17], the other five operations’ M in the range [0, 1 000 000 000]. 样例输入: 1 10 INS 1 INS 2 DEL 1 INS 3 DEL 1 ADD 1 SUB 4 QNUM 2 QBIT 1 QBIT 2 样例输出: Case 1: Del error Sub error 0 1 1
 回答 1 已采纳 Problem Description Harry Potter has some precious. For example, his invisible robe, his wand and his owl. When Hogwarts school is in holiday, Harry Potter has to go back to uncle Vernon's home. But he can't bring his precious with him. As you know, uncle Vernon never allows such magic things in his house. So Harry has to deposit his precious in the Gringotts Wizarding Bank which is owned by some goblins. The bank can be considered as a N × M grid consisting of N × M rooms. Each room has a coordinate. The coordinates of the upperleft room is (1,1) , the downright room is (N,M) and the room below the upperleft room is (2,1)..... A 3×4 bank grid is shown below: Some rooms are indestructible and some rooms are vulnerable. Goblins always care more about their own safety than their customers' properties, so they live in the indestructible rooms and put customers' properties in vulnerable rooms. Harry Potter's precious are also put in some vulnerable rooms. Dudely wants to steal Harry's things this holiday. He gets the most advanced drilling machine from his father, uncle Vernon, and drills into the bank. But he can only pass though the vulnerable rooms. He can't access the indestructible rooms. He starts from a certain vulnerable room, and then moves in four directions: north, east, south and west. Dudely knows where Harry's precious are. He wants to collect all Harry's precious by as less steps as possible. Moving from one room to another adjacent room is called a 'step'. Dudely doesn't want to get out of the bank before he collects all Harry's things. Dudely is stupid.He pay you $1,000,000 to figure out at least how many steps he must take to get all Harry's precious. Input There are several test cases. In each test cases: The first line are two integers N and M, meaning that the bank is a N × M grid(0<N,M <= 100). Then a N×M matrix follows. Each element is a letter standing for a room. '#' means a indestructible room, '.' means a vulnerable room, and the only '@' means the vulnerable room from which Dudely starts to move. The next line is an integer K ( 0 < K <= 4), indicating there are K Harry Potter's precious in the bank. In next K lines, each line describes the position of a Harry Potter's precious by two integers X and Y, meaning that there is a precious in room (X,Y). The input ends with N = 0 and M = 0 Output For each test case, print the minimum number of steps Dudely must take. If Dudely can't get all Harry's things, print 1. Sample Input 2 3 ##@ #.# 1 2 2 4 4 #@## .... #### .... 2 2 1 2 4 0 0 Sample Output 1 5
 回答 1 已采纳 Problem Description Recently, a new emerging game has become popular in Hogwarts. The goal of the game is to connect all islands in the ground with rainbows. At the beginning, n islands are isolated and the player arrive at the first island. There is a red magic set and a blue magic set on each island. Once the players of the game arrive at one of the islands, they will follow the sequence, which is firstly entering the red magic set, then the blue one. When a player enters the red magic set, he/she has the possibility of p to gain a rainbow, thereby two random island of all will be connected by the rainbow(including which two have been connected). When a player enters the blue magic set, he/she will be sent to one of the s islands with same possibility. One unit of total magic volume will be expended when the player uses the blue magic. At the end of the game, the winner is the one who consumes the least of total magic volume. However, the brilliant Hermione despises the game, she wants to know the expected magic volume to be taken away the goal of the game was achieved. Input There are multiply test cases. The first line contains an integer T(T<=100), indicates the number of cases. For each case the first line contains an integer n, indicates the number of the islands. (1<=n<=20) Then there will be n numbers, pi indicates the possibility to gain a rainbow for the ith island. (0<pi<1) The next n lines, each line firstly contains an integer s, then followed by s integers, indicates the number of which the ith island can arrive at. (1 <= s <= n) Output For each test case, you should output “Case #K: “ first, where K indicates the case number and counts from 1. Then output the answer. Round the answer to the sixth digit after the decimal point. Sample Input 2 3 0.123 0.984 0.63 2 1 2 2 2 3 2 1 3 2 0.75 0.34 2 1 2 2 1 2 Sample Output Case #1: 4.931167 Case #2: 1.458716
 Boomni_Sun的博客 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 tw...
 大章鱼（张文哲的博客 题意：实现A+B三位数的不同进制下转换 #include<iostream> using namespace std; int main() { int a=0,b=0,c=0; for(int i=0; i<2; ++i) { int f,d,e; scanf("%d.%d.%d",&f,&d,&e); ...
 感觉自己就是个bug的博客 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...
 清風逐尘乀的博客 我的PATADVANCED代码仓：https://github.com/617076674/PATADVANCED 原题链接：... 题目描述： 知识点：进制转换、数据越界 思路：转换为Knut相加，再转换为Galleon.Sickle...
 AshleyScsy的博客 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 ...
 公众号【我不是匠人】的博客 a , b , c , x , y , z ; scanf ( "%lld.%lld.%lld %lld.%lld.%lld" , & a , & b , & c , & x , & y , & z ) ; long long sum = a * 29 * 17 + b * 29 + c + x * 29 * 17 + y * 29 + z ; ...
 治 学的博客 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 ...
 virgilshi的博客 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 ...
 Simma1101的博客 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 twentynine Knuts to...
 EggyGeDan的博客 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 twentynine Knuts to a Si...
 鸡冠花12138的博客 1058A+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 ....
 青年小陈陈的博客 #include #include #include #include #include using namespace std; int main() ...// freopen("in.txt","r",stdin);... long long a[3],b[3],c[3],carry; scanf("%lld.%lld.%lld %lld.%lld.%lld
 dulongxiang的博客 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...
 cobread的博客 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 twentynine Knuts to...
 猪突猛进！的博客 题目链接： ...知识点笔记： 第一次提交有一个2分的case没有过去，最后发现还是边界问题，g... ll sum = A+B; g=sum/Galleon; s=sum%Galleon/Sickle; k=sum%Sickle; printf("%lld.%lld.%lld",g,s,k); return 0; }
 ur_ytii的博客 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 twentynine Knuts to a Si...