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. 使用horovod构建分布式深度学习框架

    最近两周一直在尝试着分布式深度学习的架构,主要的原因一方面是几台机子全是1060卡,利用深度网络在较大数据样本上训练的效率极其低下,所以尝试着将几台机子做成分布式,看看能否提高训练效率:第二方面是有人 ...

  2. Python实用黑科技——以某个字段进行分组

    需求: 当前有个字典实例,你想以某个字段比如”日期”对整个字典里面的元素进行分组. 方法: itertools.groupby()函数是专门用来干这个活的.请看下面这个例子,这里有一个列表构成的字典, ...

  3. django快速实现完整登录系统,把登陆注册串在一起并增加cookie(六)

    1.使用之前创建的项目和应用  mysite3 account 2.使用之前的数据库构造 class User(models.Model): username=models.CharField(max ...

  4. InnoDB缓存---InnoDB Buffer Pool

    InnoDB Buffer Pool 定义 对于InnoDB存储引擎,不管用户数据还是系统数据都是以页的形式存储在表空间进行管理的,其实都是存储在磁盘上的. 当InnoDB处理客户端请求,需要读取某页 ...

  5. CISCO实验记录二:路由器基本操作

    一.路由器基本操作要求 1.设置路由器本地时间 2.启用光标跟随 3.设置路由器标语信息和描述信息 4.为接口配置描述信息 5.快速恢复接口到出厂设置 二.路由器基本操作命令 1.设置路由器本地时间 ...

  6. mybatis 批量将list数据插入到数据库

    随着业务需要,有时我们需要将数据批量添加到数据库,mybatis提供了将list集合循环添加到数据库的方法.具体实现代码如下: 1.mapper层中创建 insertForeach(List < ...

  7. Qt 单元测试

      使用Qtcreator 自带的单元测试工具框架QTestlib进行测试. 一.创建一个单元测试程序 new project->other project ->Qt unit test ...

  8. 数据库 | SQL查询&LIMIT的用法

    body{ text-align:left; width:80%; margin:10px 100px; } 前言 select top n 形式的语句可以获取查询的前几个记录,但是 mysql没有此 ...

  9. linux简单命令---网络编程

    ---------------------------------------------------------------------------------------------------- ...

  10. 《A Survey on Transfer Learning》迁移学习研究综述 翻译

    迁移学习研究综述 Sinno Jialin Pan and Qiang Yang,Fellow, IEEE 摘要:   在许多机器学习和数据挖掘算法中,一个重要的假设就是目前的训练数据和将来的训练数据 ...