ZOJ 3958 Cooking Competition
来源:互联网 发布:java eclipse 编辑:程序博客网 时间:2024/05/18 03:00
“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)?
解题思路
简单模拟
- a[i] = 1, Kobayashi +1
- a[i] = 2, Tohru + 1
- a[i] = 3, Kobayashi and Tohru +1
- a[i] = 4, Kobayashi and Tohru -1
判断两人分数谁高,或者平局 Draw
。
代码
#include<bits/stdc++.h>using namespace std;int a[22];int main(){ int T, n; scanf("%d",&T); while(T-- && scanf("%d",&n)) { int tohru = 0, kobayashi = 0; for(int i=1;i<=n;i++) { scanf("%d",&a[i]); if(a[i]&1) kobayashi++; if(a[i]&2) tohru++; if(a[i]==4) tohru--, kobayashi--; } if(tohru == kobayashi) printf("Draw\n"); else if(kobayashi > tohru) printf("Kobayashi\n"); else printf("Tohru\n"); }}
- ZOJ 3958 Cooking Competition
- ZOJ 3958 Cooking Competition【】
- zoj 3958 Cooking Competition
- ZOJ 3958Cooking Competition
- ZOJ 3958 Cooking Competition 题解
- Cooking Competition
- Cooking Competition
- Cooking Competition
- ZOJ3958-Cooking Competition
- ZOJ3958 Cooking Competition
- Cooking
- cooking
- Competition
- cooking处理
- Cooking 笔记
- FOOD COOKING
- Cooking food
- 【题解】cooking
- ZOJ 3959 Problem Preparation
- 选择器
- 【笔记】formvalidtor常见问题总结
- 详解c++指针的指针和指针的引用
- R语言-文本挖掘 主题模型 文本分类
- ZOJ 3958 Cooking Competition
- 字体
- 如何在 webpack 中引入未模块化的库,如 Zepto
- 题目1368:二叉树中和为某一值的路径
- mac osx系统中python的libsvm配置
- LeetCoder 3. Longest Substring Without Repeating Characters
- 行距和对齐方式
- uboot的环境变量
- mina3源码分析,回话过程创建(二)