ZOJ 3958 Cooking Competition 题解
来源:互联网 发布:康麻子 知乎 编辑:程序博客网 时间:2024/06/06 06:50
题意
两个人比赛厨艺,有n个评委,每个评委可能给出4种评价,1表示A加1分,B不加分,2表示A不加分,B加1分,3表示两人各加1分,4表示两人各扣1分,问最后谁赢了比赛还是平局
思路
按题意用循环和判断模拟即可
代码
#include <iostream>#include <cstdio>using namespace std;int main(){ int T,a,b,n,t; scanf("%d",&T); while(T--) { scanf("%d",&n); a=0; b=0; for(int i=0;i<n;i++) { scanf("%d",&t); if(t==1) a++; else if(t==2) b++; else if(t==3) { a++; b++; } else { a--; b--; } } if(a>b) printf("Kobayashi\n"); else if(a==b) printf("Draw\n"); else printf("Tohru\n"); } return 0;}
0 0
- ZOJ 3958 Cooking Competition 题解
- ZOJ 3958 Cooking Competition
- ZOJ 3958 Cooking Competition【】
- zoj 3958 Cooking Competition
- ZOJ 3958Cooking Competition
- Cooking Competition
- Cooking Competition
- Cooking Competition
- ZOJ3958-Cooking Competition
- ZOJ3958 Cooking Competition
- 【题解】cooking
- Cooking
- cooking
- ZOJ题解
- Competition
- zoj 1387 译题+题解
- zoj 1438 - Asteroids! 题解
- zoj--1089--Lotto题解
- poj 1149 pigs
- android getLong()用法
- Spring注解管理transaction
- NPM 中 --save 和 --save-dev的区别
- OpenCV特征点检测------Surf(特征点篇)
- ZOJ 3958 Cooking Competition 题解
- ssh登录慢怎么办
- UOJ#206. 【APIO2016】Gap
- 第十五届北京师范大学程序设计竞赛决赛(网络同步赛)
- zoj 3965 Binary Tree Restoring(* dfs)
- Ajax进阶----jQuery中的Ajax(下)
- Mike and gcd problem CodeForces
- UVA 11400 01背包
- C#145课的主要内容