http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3958
按照题意来就可以了。
#include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
long long s1=0,s2=0;
for(int i=0;i<n;i++)
{
int a;
cin>>a;
if(a==1)s1++;
else if(a==2)s2++;
else if(a==3)s1++,s2++;
else s1--,s2--;
}
if(s1>s2)
{
cout<<"Kobayashi"<<endl;
}
else if(s1<s2){
cout<<"Tohru"<<endl;
}
else cout<<"Draw"<<endl;
}
return 0;
}
本文提供了一道 ACM 浙江大学在线评测题目 3958 的解答思路及 C++ 实现代码。通过解析输入数据的不同类型,计算两个角色之间的得分变化,最终确定胜者。
226

被折叠的 条评论
为什么被折叠?



