2020.03.08 test questions 3

topic

November 3, 2018, the highly anticipated World League Finals S8 open play in Incheon, South Korea, the first time in eight years two teams in the same group in the championship finals, IG and FNC lead players look forward to the duel. S8 final World Cup champion was born! IG3: 0 rout FNC win the victory! China won the world championship LOL!
Here Insert Picture Description
Members of the ACM-ICPC lab excited after hearing the news, he decided to develop a game --ZZU Union. After the small J is responsible for each game MVP award modular design, based on how each team's performance in the game, selected the MVP of the spot stumped him, I need your help. LOL in a real game, MVP selection involves damage output, withstand injury and death than the average get money per minute, 10% damage to the tower, and the size of the dragon creeps control, time control 2.5% of the enemy, skills dodge and hit, kill, even kill, a team loaded with team contribution (team battles efficiency ratio), support efficiency (Offered rate), the hero position and proficiency expected (game default) with, KDA (kill kill, death death assists Assist) and so a lot of factors. ZZU Union and its first version, the decision is not considered less complex, using the evaluation index is as follows:
(1) damage output value Dps (0 = <Dps <= 50000)
(2) to obtain a total number of money M (0 = <M <30000 =)
(. 3) of the column damage Tow (0 = <Tow <= 10000)
(. 4) Support ratio S (0 = <S <= 100)
(. 5) kill K, death D, assists A (0 = <K, D, A <= 30)
wherein each value is an integer.
Finally, for each player has a MVP candidate value (double-precision real)
V = Dps / 50000 + M / Tow 30000 + / 10000 + S / 100 + (K + A) / (D +. 1)
The MVP winner is the biggest winner prescription V value of the player, MVP ensure data every game is unique.
Input format:
The first line of an integer T (1 = <T <= 200), T represents the total of the next set of test data
for each set of test data, the
first row, win / lose, represents Blues win / loss Next 5 rows, respectively 5 index statistics after the game players, where each row are formatted as
a player ID Dps M Tow SKDA (player ID no more than 20 characters in length, separated by a space full of all contents)
followed by a behavior win / lose, Legionella represents purple win / loss
next row 5 5 likewise purple legion record players, the same format as
the player ID Dps M Tow SKDA
output format:
T line, for each test case, the output of the field Mvp player game player ID

Sample input:
2
win
ZXY 23197 13453 8636 61 is. 6. 3. 3
FXR. 4 12155 9854 8769 10 57 is 2
SGL 21232 23717 5215 67 24 23 is 25
CY 27 8268 201 3151 of 21 is 0. 8
LZH 22306 15051 6246 54 is 22 is 28. 5
lose
CHJ 16800 14340 4185 90. 19 20 is 23 is
CWC 2646 1759 6548 60 0. 7. 5
WJK 11467 951 9615 52 is. 4 16. 11
LMC 29038 11256 173 64. 8. 3. 3
LX 4686 11291 2677 77 16 26 is 22 is
lose
LZL 7670 14713 4174 42 is. 6 23 is. 7
Gy 13955 5514. 5087 29. 4 15 91 is
sq. 13 is 253 4773 7454. 9. 6. 1
GXB. 7 32055 16 7682 6093 83 26 is
GXH 24687 12611 3652 70 10 25 29
win
ZYJ 5074 64 12640 1414 29. 8. 6
HZY 23484 20429 6293 2 16 54 is 22 is
hzp 14823 20893 448 58 9 9 10
SJF 13059 6451 2344 72 5 13 17
TJT 26347 13267 5171 46 6 23 15

Sample output:
ZXY
ZYJ

Code Display

#include<stdio.h>
#include<string.h>
int main()
{
	char a[5],id[10][200],put[500][20];
	int dps,m,tow,s,k,d,A,t,j=0,temp=0,count=0;
	double v[5];
	scanf("%d",&t);
	for(int i=0;i<2*t;i++)
	{
		 temp=0;
		scanf("%s",a);
		for(j=0;j<5;j++)
		{
		scanf("%s%d%d%d%d%d%d%d",id[j],&dps,&m,&tow,&s,&k,&d,&A);
		v[j]=dps/50000.0+m/30000.0+tow/10000.0+s/100.0+(double)(k+A)/(double)(d+1);	
			if(v[temp]<v[j])
				temp=j;	
		}
		if(a[0]=='w')
		{
			strcpy(put[count],id[temp]);
			count++;
		}
	}
	for(j=0;j<t;++j)
		printf("%s\n",put[j]);				
	return 0;
} 

Ideas analysis

1, first of all, was the subject of analysis: each set of data containing the two teams win and lose data, each set of data shows only the members of the team for the win MVP, MVP determine the conditions in question following the judgment condition.
2, during input, the first input integers n, there are several sets of data determined, therefore, there are two options, the first one: Create two arrays to respectively store a win / lose, =; two dimensional array , the results are stored five members of each team, carried out n cycles, the output win the MVP; however, in order to reduce memory, may wish to use the second method, increasing the number of cycles is 2n, define only a two-dimensional array and an array , are stored win / lose, five players score, calculated according to each of the team members optimal calculation method MVP, the team determines whether the win or output pass.
(For the first calculation output why, in my opinion, each set of data need to be inputted, it is impossible to determined win / false and determines whether to go to Pass, it may be determined whether the operation proceeds MVP by win / false, Analyzing it may try to win / false, selecting whether to enter calculates MVP) after the input data
v 3, for determining win / false, and only needs to determine an array of recorded [0] to, in a predetermined calculation formula when MVP, need to consider the types of data, if necessary, data type conversion is required to force a piece of code as follows:

scanf("%s%d%d%d%d%d%d%d",id[j],&dps,&m,&tow,&s,&k,&d,&A);
		v[j]=dps/50000.0+m/30000.0+tow/10000.0+s/100.0+(double)(k+A)/(double)(d+1);	

4, subject to the requirements and restrictions output to meet the cyclic structure, each time we need to be stored is determined that the MVP, together with the final output. So we chose the library functions strcpy function string in the function for copying the name of a member of the team win the MVP to put [] (Output) array in order to complete the operation the next MVP of output.

if(a[0]=='w')
		{
			strcpy(put[count],id[temp]);
			count++;
		}
Published 19 original articles · won praise 0 · Views 458

Guess you like

Origin blog.csdn.net/zzu957/article/details/104815115