题意:

你面前有三个怪物,他们分别有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. 实现简易版德州扑克|学习麻瓜编程以项目为导向入门前端 HTML+CSS+JS

    实现简易版德州扑克 1.先上达到网页效果图(简易版德州扑克) 网页分为发牌区和牌池,上面为发牌区,下面是牌池区 2. 代码实现 2.1 HTML和JS代码 ` <link rel="s ...

  2. ABAP-ALV-如何去掉OO方法中的ALV的标准按钮

    SAP在做报表开发中,不同公司对报表的风格往往各异,为此经常在使用OO方法做ALV报表中需要去掉自带的工具栏而自行添加一些工具按钮,下面将简单介绍一些其实现过程与原理: 步骤一: DATA : gt_ ...

  3. 高效率同步降压变换器,24V转3.3V降压芯片

    PW2312是一个高频,同步,整流,降压,开关模式转换器与内部功率MOSFET.它提供了一个非常紧凑的解决方案,以实现1.5A的峰值输出电流在广泛的输入电源范围内,具有良好的负载和线路调节. PW23 ...

  4. perl打开本地/服务器图片

    index.html <html> <body> <h2> perl read img </h2> <img src = "displa ...

  5. Gradle使用及配置

    构建工具:Gradle(6.8) 下载地址:https://gradle.org/releases/ 下载最新版的二进制文件即可,下载"gradle-6.8.1-bin.zip文件,下载后完 ...

  6. ubuntu安装mysql5.6

    安装mysql5.6在ubuntu上安装mysql5.6的版本 1.添加mysql5.6的源 sudo apt-get install software-properties-common sudo ...

  7. Windows和Linux下apache-artemis-2.10.0安装配置

     window下安装配置 一.官网下载 http://activemq.apache.org/artemis/download.html 二.百度网盘下载 链接:https://pan.baidu.c ...

  8. Linux sudo权限提升漏洞整改方法

    一.漏洞概述 1月26日,Sudo发布安全通告,修复了一个类Unix操作系统在命令参数中转义反斜杠时存在基于堆的缓冲区溢出漏洞.当sudo通过-s或-i命令行选项在shell模式下运行命令时,它将在命 ...

  9. bzoj 2038(莫队算法)

    2038: [2009国家集训队]小Z的袜子(hose) 时间限制: 20 Sec  内存限制: 259 MB 题目描述 作为一个生活散漫的人,小Z每天早上都要耗费很久从一堆五颜六色的袜子中找出一双来 ...

  10. Integer的十进制转二,八,十六进制

    1,toBinaryString(int i) 将i以二进制形式输出出来 2,toOctalString(int i)将i以八进制形式输出出来 3,toHexString(int i)将i以十六进制形 ...