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.

TypeFeedbackScore Change
(Kobayashi)
Score Change
(Tohru)
1Kobayashi cooks better+10
2Tohru cooks better0+1
3Both of them are good at cooking+1+1
4Both 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 a1a2, ... , 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,直接扫一遍就好了

 1 #include <bits/stdc++.h>
 2 
 3 using namespace std;
 4 
 5 #define MP make_pair
 6 #define PB push_back
 7 typedef long long LL;
 8 typedef pair<int,int> PII;
 9 const double eps=1e-8;
10 const double pi=acos(-1.0);
11 const int K=1e6+7;
12 const int mod=1e9+7;
13 
14 int n,sa,sb;
15 
16 int main(void)
17 {
18     int t;cin>>t;
19     while(t--)
20     {
21         sa=sb=0;
22         cin>>n;
23         for(int i=1,x;i<=n;i++)
24         {
25             scanf("%d",&x);
26             if(x==1)    sa++;
27             else if(x==2)   sb++;
28             else if(x==3)   sa++,sb++;
29             else sa--,sb--;
30         }
31         if(sa>sb)
32             printf("Kobayashi\n");
33         else if(sa<sb)
34             printf("Tohru\n");
35         else
36             printf("Draw\n");
37     }
38     return 0;
39 }

 

转载于:https://www.cnblogs.com/weeping/p/6764478.html

AI实战-仿真交易欺诈行为分类数据集分析预测实例(含10个源代码+419.69 KB完整的数据集) 代码手工整理,无语法错误,可运行。 包括:10个代码,共49.42 KB;数据大小:1个文件共419.69 KB。 使用到的模块: pandas os sklearn.model_selection.train_test_split sklearn.ensemble.RandomForestClassifier sklearn.metrics.classification_report imblearn.over_sampling.SMOTE sklearn.linear_model.LogisticRegression sklearn.metrics.accuracy_score datetime.datetime sklearn.svm.SVC seaborn sklearn.preprocessing.StandardScaler sklearn.preprocessing.OrdinalEncoder sklearn.compose.ColumnTransformer imblearn.pipeline.Pipeline numpy matplotlib.pyplot statsmodels.formula.api sklearn.model_selection.StratifiedKFold sklearn.metrics.roc_auc_score contextlib pickle sklearn.pipeline.Pipeline sklearn.preprocessing.OneHotEncoder sklearn.preprocessing.PowerTransformer torch torch.nn torch.nn.BCELoss torch.optim.Adam warnings scipy.stats.normaltest scipy.stats.chi2_contingency wolta.data_tools.col_types wolta.data_tools.seek_null wolta.data_tools.unique_amounts wolta.feature_tools.list_deletings wolta.data_tools.make_numerics wolta.data_tools.stat_sum wolta.data_tools.corr_analyse collections.Counter wolta.model_tools.compare_models wolta.model_tools.get_best_model sklearn.metrics.confusion_matrix sklearn.metrics.ConfusionMatrixDisplay sklearn.ensemble.GradientBoostingClassifier xgboost sklearn.model_selection.GridSearchCV sklearn.preprocessing.LabelEncoder sklearn.ensemble.StackingClassifier sklearn.metrics.roc_curve plotly.express wordcloud.WordCloud wordcloud.STOPWORDS
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值