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 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,直接扫一遍就好了
#include <bits/stdc++.h> using namespace std; #define MP make_pair
#define PB push_back
typedef long long LL;
typedef pair<int,int> PII;
const double eps=1e-;
const double pi=acos(-1.0);
const int K=1e6+;
const int mod=1e9+; int n,sa,sb; int main(void)
{
int t;cin>>t;
while(t--)
{
sa=sb=;
cin>>n;
for(int i=,x;i<=n;i++)
{
scanf("%d",&x);
if(x==) sa++;
else if(x==) sb++;
else if(x==) sa++,sb++;
else sa--,sb--;
}
if(sa>sb)
printf("Kobayashi\n");
else if(sa<sb)
printf("Tohru\n");
else
printf("Draw\n");
}
return ;
}
2017浙江省赛 A - Cooking Competition ZOJ - 3958的更多相关文章
- 2017浙江省赛 B - Problem Preparation ZOJ - 3959
地址:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3959 题目: It's time to prepare the pr ...
- 2017浙江省赛 H - Binary Tree Restoring ZOJ - 3965
地址:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3965 题目: iven two depth-first-search ...
- 2017浙江省赛 E - Seven Segment Display ZOJ - 3962
地址:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3962 题目: A seven segment display, or ...
- 2017浙江省赛 D - Let's Chat ZOJ - 3961
地址:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3961 题目: ACM (ACMers' Chatting Messe ...
- 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 ...
- (2017浙江省赛E)Seven Segment Display
Seven Segment Display Time Limit: 2 Seconds Memory Limit: 65536 KB A seven segment display, or ...
- 2017 湖南省赛 K Football Training Camp
2017 湖南省赛 K Football Training Camp 题意: 在一次足球联合训练中一共有\(n\)支队伍相互进行了若干场比赛. 对于每场比赛,赢了的队伍得3分,输了的队伍不得分,如果为 ...
- ZOJ 3958 Cooking Competition 【水】
题目链接 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3958 AC代码 #include <cstdio> ...
- ZOJ 3879 Capture the Flag 15年浙江省赛K题
每年省赛必有的一道模拟题,描述都是非常的长,题目都是蛮好写的... sigh... 比赛的时候没有写出这道题目 :( 题意:首先输入4个数,n,q,p,c代表有n个队伍,q个服务器,每支队伍的初始分数 ...
随机推荐
- jconsole监控tomcat
一.专业术语 GC垃圾回收机制:当需要分配的内存空间不再使用的时候,JVM将调用垃圾回收机制来回收内存空间. JMX(Java Management Extensions,即Java管理扩展)是一个为 ...
- (转)The windows boot configuration data file dose not contain a valid OS entry
开价蓝屏,显示: Windows failed to start. A recent hardware or software change might be the case.to fix the ...
- Angular 组件与模板 - 属性指令
指令概览 在 Angular 中有三种类型的指令: 组件 — 拥有模板的指令 结构型指令 — 通过添加和移除 DOM 元素改变 DOM 布局的指令 属性型指令 — 改变元素.组件或其它指令的外观和行为 ...
- 工作中php处理HTTP请求的缺陷总结
之前遇到过php在处理一部分业务的时候总是感觉有短板,有些东西总是不能随人心意.比如执行时间问题,一个进程需要读取多条数据放入数组循环执行处理流程,就会很慢,容易超时,这个超时问题 可以用php设置s ...
- __del__()
__del__() 是类的内置函数,用于定义在脚本退出之前要执行的代码,因为有这个特性,通常被用来在脚本退出前关闭文件.关闭数据库连接.关闭网络连接等操作 [root@localhost ~]$ ca ...
- 使用jq实现打印机的效果
本例中使用的是jq和es6的语法,代码如下: html: <div id="box"> this is test <br/> 这是测试用的 </di ...
- 六 Android Studio打包Eegret App (解决开机黑屏问题)
因为android studio中的SplashActivity并没有什么卵用,只是开机1s显示开机画面,1s后面还是黑屏. 在主文件中加入以下代码,就是开始游戏时显示一个居中填满屏幕的图片,游戏加载 ...
- Vue基础-渲染函数-父子组件-传递数据
Vue 测试版本:Vue.js v2.5.13 做了个 demo,把父子组件的数据都绑定到 Vue 实例 app 上,注释中的 template 相对好理解些 <div id="app ...
- 解决SecureCRT连接linux终端中文显示乱码
现象如下: 原因: SecureCRT的字符集编码不是Linux的默认编码:UTF-8 解决办法: 1.在“选项”找到“会话选项” 2.选择“外观”,设置字符编码为“UTF-8” 3.确定后,继续在终 ...
- 【Python之路】Python目录
Python基础1 -- Python由来.Python种类.编码方式, Python基础2 -- Python运算符.数据类型.enumerate.range.for循环 python基础3 -- ...