AC代码

#include <cstdio>
struct Money {
long long Galleon, Sicklke, Knut;
}A, B, Sum; void init() {
A.Galleon = B.Galleon = Sum.Galleon = 0;
A.Sicklke = B.Sicklke = Sum.Sicklke = 0;
A.Knut = B.Knut = Sum.Knut = 0;
} void Add(Money a, Money b) {
if(a.Knut + b.Knut >= 29) {
Sum.Sicklke += 1;
Sum.Knut += (a.Knut + b.Knut - 29);
} else Sum.Knut += (a.Knut + b.Knut);
if(Sum.Sicklke + a.Sicklke + b.Sicklke >= 17) {
Sum.Galleon += 1;
Sum.Sicklke += (a.Sicklke + b.Sicklke - 17);
Sum.Galleon += (a.Galleon + b.Galleon);
} else {
Sum.Sicklke += (a.Sicklke + b.Sicklke);
Sum.Galleon += (a.Galleon + b.Galleon);
}
} int main() {
#ifdef ONLINE_JUDGE
#else
freopen("1.txt", "r", stdin);
#endif // ONLINE_JUDGE
init();
scanf("%lld.%lld.%lld %lld.%lld.%lld", &A.Galleon, &A.Sicklke, &A.Knut, &B.Galleon, &B.Sicklke, &B.Knut);
Add(A, B);
printf("%lld.%lld.%lld", Sum.Galleon, Sum.Sicklke, Sum.Knut);
return 0;
}

PAT A1058 A+B in Hogwarts (20)的更多相关文章

  1. A1058 A+B in Hogwarts (20)(20 分)

    A1058 A+B in Hogwarts (20)(20 分) If you are a fan of Harry Potter, you would know the world of magic ...

  2. 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 ...

  3. 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 ...

  4. PAT (Advanced Level) Practice 1035 Password (20 分) 凌宸1642

    PAT (Advanced Level) Practice 1035 Password (20 分) 凌宸1642 题目描述: To prepare for PAT, the judge someti ...

  5. PAT (Advanced Level) Practice 1008 Elevator (20 分) 凌宸1642

    PAT (Advanced Level) Practice 1008 Elevator (20 分) 凌宸1642 题目描述: The highest building in our city has ...

  6. PAT甲级:1152 Google Recruitment (20分)

    PAT甲级:1152 Google Recruitment (20分) 题干 In July 2004, Google posted on a giant billboard along Highwa ...

  7. PAT乙级:1072开学寄语(20分)

    PAT乙级:1072开学寄语(20分) 题干 下图是上海某校的新学期开学寄语:天将降大任于斯人也,必先删其微博,卸其 QQ,封其电脑,夺其手机,收其 ipad,断其 wifi,使其百无聊赖,然后,净面 ...

  8. PAT乙级:1057 数零壹 (20分)

    PAT乙级:1057 数零壹 (20分) 题干 给定一串长度不超过 105 的字符串,本题要求你将其中所有英文字母的序号(字母 a-z 对应序号 1-26,不分大小写)相加,得到整数 N,然后再分析一 ...

  9. PAT乙级:1082 射击比赛 (20分)

    PAT乙级:1082 射击比赛 (20分) 题干 本题目给出的射击比赛的规则非常简单,谁打的弹洞距离靶心最近,谁就是冠军:谁差得最远,谁就是菜鸟.本题给出一系列弹洞的平面坐标(x,y),请你编写程序找 ...

随机推荐

  1. 0078 Java与MySQL时间戳传递/存储/协调问题--userLegacyDatetimeCode--userTimezone--serverTimezone

    00. 基本问题 0.0 版本: 驱动5.1.47和8.0.17 0.1 MySQL驱动5.1有userLegacyDatetimeCode和userTimezone两个参数, 8.0没有 0.2 J ...

  2. ES节点分析

    ES集群概念 集群 一个集群cluster由一个或者多个节点组成,具有相同的cluster.name,协同工作,分项数据和负载. 当有新的节点加入或者删除了一个节点时,集群回感知到并能够平衡数据. E ...

  3. 用单元测试来调试SilverFish AI

    [TestFixture] public class AiTest { [Test] public void Test() { Settings.Instance.LogFolderPath = @& ...

  4. Bootstrap4项目开发实战视频教程

    一.企业网站项目 课件 0.课程简介 1.顶部区域的制作 2.导航区域的制作 3.轮播区域的制作 4.产品区域的制作 5.最新资讯区域的制作 6.底部区域的制作 二.化妆品网站项目 1.项目初始化_导 ...

  5. [Java]字符串数组 与 字符串链表 之间的相互转化

    代码: package com.hy; import java.util.Arrays; import java.util.Collections; import java.util.List; pu ...

  6. 性能测试 | Linux系统top命令中的io使用率,很多人都误解了它的具体含义

    body{ text-align:left; width:80%; margin:10px 100px; } 最近在做连续数据流的缓冲系统,C语言代码实现后,粗略测试了下,功能上应该没有问题.那么,接 ...

  7. jq批量与表单赋值

    function loadData(obj) { var key, value, tagName, type, arr; for (x in obj) { key = x; value = obj[x ...

  8. Android studio怎么使用git代码文件逐行追溯

    在Android studio中集成了相当多的工具用于管理代码,应该现在经常使用的git的方式来管理管理,用于上传代码或者进行下载代码库中,而在git中进行管理的话,那么就可以进行历史的记录信息,如果 ...

  9. Android中常见的默认实现类

    * Basexxx* Defaultxxx* Simplexxx* Baicxxx

  10. 排错:Unable to create a new session key. It is likely that the cache is unavailable.

    排错:Unable to create a new session key. It is likely that the cache is unavailable. 问题 登录openstack页面, ...