Circle of Monsters(贪心)】的更多相关文章

n个怪物围成一圈,每个怪物有自己的血量和爆炸伤害. 怪物在死后会对下一个怪物造成爆炸伤害,又死了又可以爆炸...... 你每发子弹可以对怪物造成1点伤害,求杀死所有怪物的最小子弹数. 传送门 \(\color{Red}{---------------------华丽分割线w(゚Д゚)w------------------------}\) \(其实嘛,看到题目束手无策,但是看到数据范围会发现是个O(n)算法,那我们要开始找规律了.\) \(首先还是想最坏情况,每个怪物都用子弹打,答案是所有怪物的…
https://codeforc.es/gym/102222/problem/H 题意:有一堆怪兽,怪兽有HP和ATK.你有一个英雄,英雄每次先被所有怪兽打,然后打其中一个怪兽.打的伤害递增,第一次1,第二次2,以此类推. 为什么感觉是贪心呢?证明一波. 首先开始打一个怪兽肯定一直打到死为止.那么打死他要求的次数可以二分出来(其实暴力也可以).两只怪兽交换打的顺序会不会变好? 先打第一只怪兽: \(num_1*sumatk+num_2*(sumatk-atk_1)\) 先打第二只怪兽: \(nu…
A:Level Statistics 题意:统计n个游戏数据,p代表游玩次数,c代表通关次数,每次游玩都不一定通关,求这些数据是否合法 题解:1.游玩次数不能小于通关次数   2.游玩次数和通关次数必须单增  3.每次增加的游玩次数不能小于通关次数 代码: 1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 #include <cmath> 5 #include <algor…
\(Educational\ Codeforces\ Round\ 85\ (Rated\ for\ Div.2)\) \(A. Level Statistics\) 每天都可能会有人玩游戏,同时一部分人会过关,玩游戏的人数和过关的人数会每天更新,问记录的数据是否没有矛盾 //#pragma GCC optimize("O3") //#pragma comment(linker, "/STACK:1024000000,1024000000") #include<…
题目链接:https://codeforces.com/contest/1334 A. Level Statistics 题意 一个关卡有玩家的尝试次数和通关次数,按时间顺序给出一个玩家 $n$ 个时刻的数据,判断这些数据是否合理. 思路 通关次数不会多于尝试次数:$c_i≤p_i$ 后一时刻的尝试次数不会多于前一时刻:$p_i≤p_{i-1}$ 后一时刻的通关次数不会多于前一时刻:$c_i≤c_{i-1}$ 增加的通关次数不会多于增加的尝试次数:$c_i-c_{i-1}≤p_i-p_{i-1}…
There are nn monsters standing in a row numbered from 11 to nn . The ii -th monster has hihi health points (hp). You have your attack power equal to aa hp and your opponent has his attack power equal to bb hp. You and your opponent are fighting these…
It is my great honour to introduce myself to you here. My name is Aloysius Benjy Cobweb Dartagnan Egbert Felix Gaspar Humbert Ignatius Jayden Kasper Leroy Maximilian. As a storyteller, today I decide to tell you and others a story about the hero Huri…
题目: A narrow gauge train drives the visitors through the sequence of chambers in the Dark Ride attraction. The chambers are occupied by IT monsters which are specially programmed to scare the visitors in various wicked ways. There is one monster in e…
贪心的策略 #include <bits/stdc++.h> using namespace std; ; typedef long long ll; struct m { int hp,atk,num; }mon[N]; bool cmp(m a,m b) { return a.atk*b.num>b.atk*a.num;//排序的依据是被攻击的次数和攻击力的乘积 } int n; int main() { ; scanf("%d",&t); while(t…
https://codeforc.es/contest/1189/problem/B 优先考虑最大的元素怎么构造.拿两个次大的围着他就很好,但是其他的怎么安排呢?就直接降序排列就可以了. a数组还开错了. #include<bits/stdc++.h> using namespace std; typedef long long ll; int n; int a[100005]; int main() { #ifdef Yinku freopen("Yinku.in", &…