I'm going to take your candle.
Time limit:2000/1000 MS (java/others) Memory limit:32768/32768 K (java/others)
Total submission (s): 0 Accepted Submission (s): 0
Problem Descriptiondarkrai recently like to play "Furnace stone legend", he used in a game of Jaina heroes, chose the Ice law deck.
The purpose of the Stone legend game is to reduce the hero's health to 0 points and less than 0 points, who wins first.
Furnace stone legend There is a rule limit is mana crystal, each turn players will have a certain mana crystal (all of this topic as 10), each use of a card, will consume the cards in the upper left corner of the number of Mana crystal, mana Crystal is not enough to use.
4 cards are involved in this topic: Fireball, ICE arrow, dog-headed, and evolutionary poodle, of which
Fireball-Costs 4 mana crystals, which can damage 6 of points.
Ice Arrows-Spend 2 mana crystals, which can cause 3 damage (in this topic, you do not have to consider freezing effects).
The dog-man's master--spends 2 mana crystals, and when used, you will summon a dog-headed master, and then the damage to all spells (fireballs, ice arrows) You use will be +1. (The bonus effect can be superimposed, such as when you summon 2 of the dog's minions, the damage value will be +2).
The evolutionary poodle--Spending 4 mana crystals, the effect analogy to the dog-man's master, but the damage value of +2 (the same can be superimposed).
Now, he's in the game is forced to a similar situation! He has only 1 drops of blood, and no entourage on the field, if he cannot defeat his opponent in this round, he will be defeated by his opponent in the next round!
Now, would you be wise to help him figure out if he can beat his opponent?
Note 1: The effect of the dog-headed master and the evolutionary poodle can be superimposed.
Note 2: This topic, do not consider the following attacks, regardless of hero skills, and do not consider the actual game of each card only 2 limit (in other words, the title of each card number may be greater than 2), only consider the 4 kinds of cards as described above. Input data The first line is a positive integer T (t<=200), which represents the number of groups of test data.
Next T line, 2 positive integers per line n (<=10), M (<=30), n represents the number of Darkrai hands, and M represents the opponent's health value.
Next n lines, one string per line, "Fire" represents a fireball, "ice" represents a ice arrow, "dog" stands for a dog-headed evolved, and "The King" represents an evolutionary poodle. Output outputs a row of answers for each set of data.
If the Darkrai can beat the opponent, output "Yes", otherwise output "No".
Sample Input6Fire
Sample OutputYes solution: Violent combination, bounds are spent equal to 10 and damage greater than or equal to M to judge Yes
#include <bits/stdc++.h>using namespaceStd;map<string,int>Q;intMain () {intT; CIN>>T; while(t--) {q.clear (); intn,m; CIN>>n>>m; for(intI=1; i<=n; i++) { strings; CIN>>s; Q[s]++; } intflag=0; for(intI=0; i<=Ten; i++) { for(intj=0; j<=Ten; j + +) { for(inty=0; y<=Ten; y++) { for(intz=0; z<=Ten; z++) { if(i<=q["Dog"]&&j<=q["Evolved"]&&y<=q["Kindle"]&&z<=q["Ice"]) { if(i*2+4*j+4*y+z*2<=Ten) { intsum=0; intsum1=1*i+j*2; Sum=(6+SUM1) *y+ (3+SUM1) *Z; if(sum>=m) {//cout<< "Yes" <<endl;flag=1; Break; } } } } } } } if(flag==0) {cout<<"No"<<Endl; } Else{cout<<"Yes"<<Endl; } } return 0;}
Hangzhou Computer Program Design Competition (2016 ' 12)-Network synchronization 1004