题意:

你面前有三个怪物,他们分别有a, b, c点血量。现在你可以指定一个怪物,用大炮向他们射击,之后该怪物就会掉一滴血。每七次射击就会使得炮弹威力加强一次,即第7, 14, 21次射击的时候炮弹威力会被加强,加强的炮弹可以对三个怪物分别造成一点伤害。现在问你可不可能在某次被加强的炮弹发射后,使得所有的怪物血量变成0。

思路:

首先每七次射击,总共会造成9点伤害(6 + 3),因此如果要让所有怪物在某次被加强的炮弹发射后血量变为0,则需要他们的血量和为9的倍数。其次每个怪物的血量不能少于被加强的炮弹的发射个数,因为每次被加强的炮弹发射后所有的怪物血量都会减一,而血量不会不会为负数。

AC代码:

#include <cstdio>
#include <algorithm> const int inf = 0x3f3f3f3f; int main () {
int T, a[3];
scanf ("%d", &T);
while (T--) {
int tot = 0, minn = inf;
for (int i = 0; i < 3; i++) {
scanf ("%d", &a[i]);
tot += a[i];
minn = std::min (minn, a[i]);
}
if (minn < tot / 9 || tot % 9 != 0) {
printf ("NO\n");
} else {
printf ("YES\n");
}
}
return 0;
}

CF1463-A. Dungeon的更多相关文章

  1. [LeetCode] Dungeon Game 地牢游戏

    The demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dungeon. ...

  2. POJ 2251 Dungeon Master(3D迷宫 bfs)

    传送门 Dungeon Master Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 28416   Accepted: 11 ...

  3. poj 2251 Dungeon Master

    http://poj.org/problem?id=2251 Dungeon Master Time Limit: 1000MS   Memory Limit: 65536K Total Submis ...

  4. ✡ leetcode 174. Dungeon Game 地牢游戏 --------- java

    The demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dungeon. ...

  5. leetcode174. Dungeon Game

    // learn from https://discuss.leetcode.com/topic/6912/c-dp-solution ''' class Solution { public: int ...

  6. 【leetcode】Dungeon Game

    Dungeon Game The demons had captured the princess (P) and imprisoned her in the bottom-right corner ...

  7. Dungeon Game ——动态规划

    The demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dungeon. ...

  8. Java for LeetCode 174 Dungeon Game

    The demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dungeon. ...

  9. LeetCode Dungeon Game

    原题链接在这里:https://leetcode.com/problems/dungeon-game/ 这是一道DP题,保存当前格到右下格所需要的最小体力,m*n的dp数组保存. 更新是Math.mi ...

  10. Dungeon Master 分类: 搜索 POJ 2015-08-09 14:25 4人阅读 评论(0) 收藏

    Dungeon Master Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 20995 Accepted: 8150 Descr ...

随机推荐

  1. zabbix客户端安装配置

    1.下载,解压并安装zabbixtar zxvf zabbix-2.0.12.tar.gzcd zabbix-2.0.12./configure --prefix=/usr/local/zabbix ...

  2. 动态sql语句、逆向工程(generator)、分页助手(pagehelper)

    1.动态sql语句 if if where 配合使用 <select id="selectByWhere" resultType="com.alibaba.wlq. ...

  3. Transparent Gateway的使用方法

    前言 使用Transparent Gateway(透明网关),建立ORACLE与SQLServer的连接. 实现功能:在ORACLE中查询SQLServer数据库的内容. 注:网上有ORACLE和SQ ...

  4. Mybatis plus通用字段自动填充的最佳实践总结

    在进行持久层数据维护(新增或修改)的时候,我们通常需要记录一些非业务字段,比如:create_time.update_time.update_by.create_by等用来维护数据记录的创建时间.修改 ...

  5. JavaScript中的Promise【期约】[未完成]

    JavaScript中的Promise[期约] 期约主要有两大用途 首先是抽象地表示一个异步操作.期约的状态代表期约是否完成. 比如,假设期约要向服务器发送一个 HTTP 请求.请求返回 200~29 ...

  6. SpringBoot配置文件基础部分说明

    SpringBoot-yml文件配置说明 友情提示:有一些代码中有乱码,请脑补删除,适合快速入门 #开启spring的Bebug模式,可以查看有哪些自动配置生效 #debug=true #开启热启动, ...

  7. code-server scala error: object apache is not a member of package org

    原因是scala缺少包,需要把spark或对应的包放入scala目录下的lib,然后重启主机,在terminal输入reboot即可. 如果不重启主机,则在交互式编程中可以成功import.但是直接在 ...

  8. InnoDB 事务隔离级探索

    https://mp.weixin.qq.com/s/gWYL2Th9Go5LDhkyGB_rYQ

  9. 服务降级 托底预案 Nginx中使用Lua脚本检测CPU使用率,当达到阀值时开启限流,让用户排队

    https://mp.weixin.qq.com/s/FZAcQQAKomGEe95kln1HCQ 在京东我们是如何做服务降级的 https://mp.weixin.qq.com/s/FZAcQQAK ...

  10. Python基础(列表、元组)

    列表 在Python中列表用[]来表示,中间的元素可以是任何类型,用逗号分隔.列表是可变类型. 列表常用操作:增删改查. names = ["小明","小红", ...