2017.07.16小组赛题目D
来源:互联网 发布:mac lion dmg 编辑:程序博客网 时间:2024/04/29 05:24
D - 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 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.
(Kobayashi)
(Tohru)
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)?
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.
<h4< dd="">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).
<h4< dd="">231 2 123 4
KobayashiDraw
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.、
本文大体的意思是:有这么两个人,在以下的评分人下面,谁的分数高就是谁赢
C语言代码:
#include<stdio.h>
int a[5]={0,1,0,1,-1};
int b[5]={0,0,1,1,-1};
int main()
{
int n;
int digit[105];
while(scanf("%d",&n)!=EOF)
{
int i,m,j;
int sum1,sum2;
for(i=0;i<n;i++)
{
scanf("%d",&m);
sum1=0;
sum2=0;
for(j=0;j<m;j++)
{
scanf("%d",&digit[j]);
sum1=sum1+a[digit[j]];
sum2=sum2+b[digit[j]];
}
if(sum1==sum2)printf("Draw\n");
else if(sum1>sum2)printf("Kobayashi\n");
else if(sum1<sum2)printf("Tohru\n");
}
}
return 0;
}
- 2017.07.16小组赛题目D
- 2017.07.16小组赛题目I
- hdu1181 变形课 (小组赛D)
- akoj-1264-足球世界杯小组赛
- YTUOJ-世界杯小组赛
- 题目353:3D dungeon
- 2014巴西世界杯小组赛赛程
- 第16周 oj题目问题 D: 指针引出奇数因子
- codeforce 14D 无向图题目
- NYOJ---题目366D的小L
- 题目: poj – 3669(D题)
- Tony说世界杯之小组赛预测篇
- 世界杯小组赛积分所有可能情况
- YTU 2615: AB编程题--世界杯小组赛
- hdu2564词组缩写 (小组赛F) 水
- hdu2156 分数矩阵(小组赛I) 水
- poj1751 Highways 最小生成树(小组赛A)
- hdu1671 Phone List 字典树(小组赛E)
- vue-cli 构建的项目中如何使用 Less
- springmvc返回值问题
- TensorFlow 训练好模型参数的保存和恢复代码
- A1082. Read Number in Chinese (25)
- java乐观锁和悲观锁的实现
- 2017.07.16小组赛题目D
- 第二封信 / 时代宿命是时代的罪过
- HDU 3172 Virtual Friends(并查集+map+输入)
- ROC曲线与代价曲线
- webstorm工具使用的快捷键
- C 关于链表的一些操作
- Android 增量更新
- 一个简单的Makefile教程
- Python编程_Lesson008_Python特性