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. kong-dashbord本地安装gulp打包报错的解决办法

    本地安装kong-dashbord执行npm run build 报如下错误 gulp[]: ../src/node_contextify.cc::]->IsString()' failed. ...

  2. deepin Linux 安装+工作学习配置

    一 安装 在官网下载 U盘安装,神舟优雅x4开机按F7,选择U盘启动. U盘安装器在下载的镜像文件中. 二 配置 升级最新系统 设置root用户密码: dawn@dawn-PC:~$ sudo pas ...

  3. Codeforces 55D. Beautiful numbers(数位DP,离散化)

    Codeforces 55D. Beautiful numbers 题意 求[L,R]区间内有多少个数满足:该数能被其每一位数字都整除(如12,24,15等). 思路 一开始以为是数位DP的水题,觉得 ...

  4. Rhel7.4系统部署cobbler

    cobbler安装 一.系统信息: [root@openstack ~]# cat /etc/redhat-release Red Hat Enterprise Linux Server releas ...

  5. CodeForces 535C Tavas and Karafs —— 二分

    题意:给出一个无限长度的等差数列(递增),每次可以让从l开始的m个减少1,如果某个位置已经是0了,那么可以顺延到下一位减少1,这样的操作最多t次,问t次操作以后从l开始的最长0序列的最大右边界r是多少 ...

  6. JavaScript判断数据类型的4中方法

    一: typeof typeof 是一种运算符,它的值有如下几种(number.boolean.string.undefined.null.function.object.symbol) consol ...

  7. golang精选100题带答案

    能力模型 级别 模型 初级 primary 熟悉基本语法,能够看懂代码的意图: 在他人指导下能够完成用户故事的开发,编写的代码符合CleanCode规范: 中级 intermediate 能够独立完成 ...

  8. PPT:很多文字如何排版?(PPT如何美化?)

    1.加入图标.形状(或者加入图片和色块搭配) 2.提取关键词作为标题(这个很重要) 下面看下示例: 这个是没修改前 修改后: 相信大家都会喜欢第二张吧 再看一个: 最近在学做PPT,有点上瘾了,哈哈哈 ...

  9. driver.implicitly_wait不起作用的排错方法

    环境是python3.6+selenium 3.4.3+chrome64 在编写前端自动化脚本时使用implicitly_wait时不起作用 1.确认自己是否正确使用,可用简单的例子来测试,比如: 此 ...

  10. Message NNNN not found; No message file for product=network, facility=TNS

    Message NNNN not found; No message file for product=network, facility=TNS Table of Contents 1. 错误信息 ...