ZOJ3958 Cooking Competition 题解



Cooking Competition

Time Limit: 1 Second       Memory Limit: 65536 KB

"Miss Kobayashi's Dragon Maid" is a Japanese manga series written and illustrated by Coolkyoushinja. An anime television series produced by Kyoto Animation aired in Japan between January and April 2017.

In episode 8, two main characters, Kobayashi and Tohru, challenged each other to a cook-off to decide who would make a lunchbox for Kanna's field trip. In order to decide who is the winner, they asked n people to taste their food, and changed their scores according to the feedback given by those people.

There are only four types of feedback. The types of feedback and the changes of score are given in the following table.

Type Feedback Score Change
(Kobayashi)
Score Change
(Tohru)
1 Kobayashi cooks better +1 0
2 Tohru cooks better 0 +1
3 Both of them are good at cooking +1 +1
4 Both of them are bad at cooking -1 -1

Given the types of the feedback of these n people, can you find out the winner of the cooking competition (given that the initial score of Kobayashi and Tohru are both 0)?

Input

There are multiple test cases. The first line of input contains an integer T (1 ≤ T ≤ 100), indicating the number of test cases. For each test case:

The first line contains an integer n (1 ≤ n ≤ 20), its meaning is shown above.

The next line contains n integers a1a2, ... , an (1 ≤ ai ≤ 4), indicating the types of the feedback given by these n people.

Output

For each test case output one line. If Kobayashi gets a higher score, output "Kobayashi" (without the quotes). If Tohru gets a higher score, output "Tohru" (without the quotes). If Kobayashi's score is equal to that of Tohru's, output "Draw" (without the quotes).

Sample Input

2
3
1 2 1
2
3 4

Sample Output

Kobayashi
Draw

Hint

For the first test case, Kobayashi gets 1 + 0 + 1 = 2 points, while Tohru gets 0 + 1 + 0 = 1 point. So the winner is Kobayashi.

For the second test case, Kobayashi gets 1 - 1 = 0 point, while Tohru gets 1 - 1 = 0 point. So it's a draw.


Author:  WENG, Caizhi
Source:  The 14th Zhejiang Provincial Collegiate Programming Contest Sponsored by TuSimple

Submit     Status


水题,根据题意只需统计1和2的数量即可。代码如下:

#include<bits/stdc++.h>
using namespace std;

int main()
{
	int T;
	int n,i,a,b,tmp;
	cin>>T;
	while(T--)
	{
		cin>>n;
		a=0;
		b=0;
		for(i=0;i<n;i++)
		{
			cin>>tmp;
			if(tmp==1) a++;
			if(tmp==2) b++;
		}
		if(a>b) cout<<"Kobayashi"<<endl;
		if(a<b) cout<<"Tohru"<<endl;
		if(a==b) cout<<"Draw"<<endl;
	}
	return 0;
}


Cooking Competition

Time Limit: 1 Second       Memory Limit: 65536 KB

"Miss Kobayashi's Dragon Maid" is a Japanese manga series written and illustrated by Coolkyoushinja. An anime television series produced by Kyoto Animation aired in Japan between January and April 2017.

In episode 8, two main characters, Kobayashi and Tohru, challenged each other to a cook-off to decide who would make a lunchbox for Kanna's field trip. In order to decide who is the winner, they asked n people to taste their food, and changed their scores according to the feedback given by those people.

There are only four types of feedback. The types of feedback and the changes of score are given in the following table.

Type Feedback Score Change
(Kobayashi)
Score Change
(Tohru)
1 Kobayashi cooks better +1 0
2 Tohru cooks better 0 +1
3 Both of them are good at cooking +1 +1
4 Both of them are bad at cooking -1 -1

Given the types of the feedback of these n people, can you find out the winner of the cooking competition (given that the initial score of Kobayashi and Tohru are both 0)?

Input

There are multiple test cases. The first line of input contains an integer T (1 ≤ T ≤ 100), indicating the number of test cases. For each test case:

The first line contains an integer n (1 ≤ n ≤ 20), its meaning is shown above.

The next line contains n integers a1a2, ... , an (1 ≤ ai ≤ 4), indicating the types of the feedback given by these n people.

Output

For each test case output one line. If Kobayashi gets a higher score, output "Kobayashi" (without the quotes). If Tohru gets a higher score, output "Tohru" (without the quotes). If Kobayashi's score is equal to that of Tohru's, output "Draw" (without the quotes).

Sample Input

2
3
1 2 1
2
3 4

Sample Output

Kobayashi
Draw

Hint

For the first test case, Kobayashi gets 1 + 0 + 1 = 2 points, while Tohru gets 0 + 1 + 0 = 1 point. So the winner is Kobayashi.

For the second test case, Kobayashi gets 1 - 1 = 0 point, while Tohru gets 1 - 1 = 0 point. So it's a draw.


Author:  WENG, Caizhi
Source:  The 14th Zhejiang Provincial Collegiate Programming Contest Sponsored by TuSimple
Submit     Status

猜你喜欢

转载自blog.csdn.net/outp0st/article/details/80288557