2017浙江省赛 A - Cooking Competition ZOJ - 3958

地址:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3958

题目:

"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.

思路:

  手速题+1,直接扫一遍就好了

 1 #include <bits/stdc++.h>
 2
 3 using namespace std;
 4
 5 #define MP make_pair
 6 #define PB push_back
 7 typedef long long LL;
 8 typedef pair<int,int> PII;
 9 const double eps=1e-8;
10 const double pi=acos(-1.0);
11 const int K=1e6+7;
12 const int mod=1e9+7;
13
14 int n,sa,sb;
15
16 int main(void)
17 {
18     int t;cin>>t;
19     while(t--)
20     {
21         sa=sb=0;
22         cin>>n;
23         for(int i=1,x;i<=n;i++)
24         {
25             scanf("%d",&x);
26             if(x==1)    sa++;
27             else if(x==2)   sb++;
28             else if(x==3)   sa++,sb++;
29             else sa--,sb--;
30         }
31         if(sa>sb)
32             printf("Kobayashi\n");
33         else if(sa<sb)
34             printf("Tohru\n");
35         else
36             printf("Draw\n");
37     }
38     return 0;
39 }
时间: 2024-10-15 23:49:28

2017浙江省赛 A - Cooking Competition ZOJ - 3958的相关文章

2017浙江省赛 D - Let&#39;s Chat ZOJ - 3961

地址:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3961 题目: ACM (ACMers' Chatting Messenger) is a famous instant messaging software developed by Marjar Technology Company. To attract more users, Edward, the boss of Marjar Company, has re

2019省赛训练组队赛4.9周二 2017浙江省赛

A - Cooking Competition "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

2017浙江省赛 E - Seven Segment Display ZOJ - 3962

地址:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3962 题目: A seven segment display, or seven segment indicator, is a form of electronic display device for displaying decimal numerals that is an alternative to the more complex dot matrix

2017浙江省赛 H - Binary Tree Restoring ZOJ - 3965

地址:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3965 题目: iven two depth-first-search (DFS) sequences of a binary tree, can you find a binary tree which satisfies both of the DFS sequences? Recall that a binary tree is a tree in which

2017浙江省赛 C - What Kind of Friends Are You? ZOJ - 3960

地址:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3960 题目: Japari Park is a large zoo home to extant species, endangered species, extinct species, cryptids and some legendary creatures. Due to a mysterious substance known as Sandstar, a

ZOJ 3958: Cooking Competition

Cooking Competition ///@author Sycamore, ZJNU ///@date 4/22/2017 #include <iostream> #include <sstream> #include <iomanip> #include <cmath> #include <string> #include <algorithm> #include <numeric> #include <fu

CCPC 2017 网络赛

1001.我们的想法是,先构造n个要删掉的点,然后不断给图加边,使得每条边的其中一个点在n个点之中. 我们要使n个点之外的点尽量多,并且每次删掉的点在n个点之外. 贪心的决策是,每次操作,前n个点的度和令外的最大度的点度数相同. 然后删掉这个点之后,之后的操作,剩余的点也满足这个要求.所以度数最大的点必定与n个点有边. 于是可以这样构造,增加n批点(i = 1~n),每次增加n/i个点的,每个增加的点连出i条边到n个点. 这样,n个点每次增加的最大度数不超过1.但每次删点的时候(按n~1批的顺序

第14届浙江省赛--Let&#39;s Chat

Let's Chat Time Limit: 1 Second      Memory Limit: 65536 KB ACM (ACMers' Chatting Messenger) is a famous instant messaging software developed by Marjar Technology Company. To attract more users, Edward, the boss of Marjar Company, has recently added

第十四届浙江省赛

题目真的是从易到难的顺序,而且跨度非常合理,只是看到榜单上后5题只有一支队做出来了一个,其他的没人做出来啊.. A - Cooking Competition 水题. 1 #include <bits/stdc++.h> 2 using namespace std; 3 4 int n, a; 5 6 int main() { 7 // freopen("in", "r", stdin); 8 int T; 9 scanf("%d",