ZOJ Problem Set
来源:互联网 发布:数据库设计视图格式 编辑:程序博客网 时间:2024/06/08 02:44
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.
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 a1, a2, ... , 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、题意:n个人品尝两个人做的菜并打分,并按照上面的表格所规定的规则打分,最后得分高的赢,如果分数相等,则输出Draw。
2、思路:把两个人得分加起来比一比就行了。
3、代码:
#include<iostream>using namespace std;int main(){int T,n,a,b,c;cin>>T;while(T--){a=0;b=0;cin>>n;while(n--) { cin>>c; if(c==1) a++; if(c==2) b++; }if(a>b) cout<<"Kobayashi"<<endl;else if(b>a) cout<<"Tohru"<<endl;else cout<<"Draw"<<endl;}return 0;}4、总结:这是签到题吧。
0 0
- ZOJ Problem Set - 2060
- ZOJ Problem Set - 2972
- ZOJ Problem Set - 1037
- ZOJ Problem Set - 1048
- ZOJ Problem Set - 1049
- ZOJ Problem Set - 1051
- ZOJ Problem Set - 1067
- ZOJ Problem Set - 1115
- ZOJ Problem Set - 1151
- ZOJ Problem Set - 1205
- ZOJ Problem Set - 1025
- ZOJ Problem Set - 1029
- ZOJ Problem Set - 1076
- ZOJ Problem Set - 1117
- ZOJ Problem Set - 1041
- ZOJ Problem Set - 1004
- ZOJ Problem Set - 1005
- ZOJ Problem Set - 1016
- MyBatis的增删改查方法
- OracleDBconsoleorcl服务无法启动的原因及解决思路
- Hexo+Github Pages搭建个人博客
- spring aop -- 获取注解值
- 选择器selector中drawable和color的区别
- ZOJ Problem Set
- 常用生物信息学格式介绍
- “Ipad is disabled”解决方法(Ipad系统重装)
- 使用WebStorm的Macros宏指令,实现保存的同时格式化代码,并跳至行尾
- JNDI数据源
- greedy——455. Assign Cookies
- http://blog.csdn.net/chenggong2dm/article/details/7896440
- Hibernate中的多表操作
- MySQL 5.6 if与end if在触发器中的使用