HDU 4950 Monster(公式)】的更多相关文章

HDU 4950 Monster 题目链接 题意:给定怪兽血量h,你攻击力a.怪物回血力b,你攻击k次要歇息一次,问是否能杀死怪兽 思路:签到题,注意最后一下假设打死了怪,那么怪就不会回血了 思路: #include <cstdio> #include <cstring> typedef long long ll; ll h, a, b, k; bool solve() { if (a >= h) return true; if (b >= a) return fals…
题目链接:pid=4950http://acm.hdu.edu.cn/showproblem.php?pid=4950">http://acm.hdu.edu.cn/showproblem.php?pid=4950 Monster Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 220    Accepted Submission…
Monster 题目链接: http://acm.hust.edu.cn/vjudge/contest/123554#problem/I Description Teacher Mai has a kingdom. A monster has invaded this kingdom, and Teacher Mai wants to kill it. Monster initially has h HP. And it will die if HP is less than 1. Teache…
题目链接 题意:有一个怪物的血量为h,人攻击怪物,每回合可以杀掉a滴血,再回b滴血,k个回合之后人会休息一回合,即人不攻击而怪物回b滴血,问能否杀死.翻译过来就是给定一个数h,每轮可以先减a再加b,k轮后会有一轮只加b不减a,如果再这过程中存在h<=0就输出YES,否则输出NO. 题解:注意是先减a再加b,有可能不加b就已经h<=0,先分类讨论ab,如果a>b,那么只有可能第一回合杀死,一旦+b就不可能在杀死了,如果a<=b,讨论在经过k-1轮后第k轮只减不加能否<=0,再讨…
http://acm.hdu.edu.cn/showproblem.php?pid=4927 给定一个长度为n的序列a,每次生成一个新的序列,长度为n-1,新序列b中bi=ai+1−ai,直到序列长度为1.输出最后的数. n有3000果断用大数,类似杨辉三角推出每个数对最终结果的贡献,利用公式:c[n][m] = c[n][m-1]*(n-m+1)/m防超时 import java.math.BigInteger; import java.util.*; public class Main {…
http://acm.hdu.edu.cn/showproblem.php?pid=4950 给定怪兽血量h,你攻击力a,怪物回血力b,你攻击k次要休息一次,问能否杀死怪兽 特判一次打死怪兽的情况和第k次前打死怪兽的情况,否则只要能磨死怪兽即可 #include <cstdio> #include <cstdlib> #include <cmath> #include <cstring> #include <string> #include &l…
题意:给n个‘M'形,问最多能把平面分成多少区域 解法:推公式 : f(n) = 4n(4n+1)/2 - 9n + 1 = (8n+1)(n-1)+2 前面部分有可能超long long,所以要转化一下,令a = 8n+1, b = n-1,将两个数都化为a1*10^8+b1的形式,则 (a1*10^8+b1)(a2*10^8+b2) =(a1a2*10^8 + a1b2 + a2b1)*10^8 + b1b2 + 2,由于a1,a2最多2为10^4左右,中间的数就都不会超过long long…
Toxophily Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1429    Accepted Submission(s): 739 Problem Description The recreation center of WHU ACM Team has indoor billiards, Ping Pang, chess an…
River Problem Time Limit: 6000/2000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 721    Accepted Submission(s): 282 Problem Description The River of Bitland is now heavily polluted. To solve this problem, the King…
Monster Time Limit: 10000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1383    Accepted Submission(s): 363 Problem Description One day, v11 encounters a group of monsters in a foreast. In order to defend the…