• ZOJ3958 Cooking Competition


    题意 给出n个数 若为1 第一个人得一分 若为2 第二个人得一分 若为3 两个人各得一分 若为4 两个人各减一分 然后判断最后谁的分高谁就获胜

    水题 只用判断为1或2的情况计数比较大小就行了

    AC代码:

     1 #include<bits/stdc++.h>
     2 using namespace std;
     3 typedef long long ll;
     4 typedef unsigned long long ull;
     5 
     6 namespace io {
     7     const int SIZE = 1e7 + 10;
     8     char inbuff[SIZE];
     9     char *l, *r;
    10     inline void init() {
    11         l = inbuff;
    12         r = inbuff + fread(inbuff, 1, SIZE, stdin);
    13     }
    14     inline char gc() {
    15         if (l == r) init();
    16         return (l != r) ? *(l++) : EOF;
    17     }
    18     void read(int &x) {
    19         x = 0; char ch = gc();
    20         while(!isdigit(ch)) ch = gc();
    21         while(isdigit(ch)) x = x * 10 + ch - '0', ch = gc();
    22     }
    23 } using io::read;
    24 
    25 int main(){
    26     int t;
    27     scanf("%d", &t);
    28     int n, x;
    29     int cnt1, cnt2;
    30     while (t--){
    31         scanf("%d", &n);
    32         cnt1 = 0;
    33         cnt2 = 0;
    34         for (int i = 0; i < n; i++){
    35             cin>>x;
    36             if (x == 1) cnt1++;
    37             else if (x == 2) cnt2++;
    38         }
    39         if (cnt1 > cnt2) cout<<"Kobayashi"<<endl;
    40         else if (cnt1 == cnt2) cout<<"Draw"<<endl;
    41         else cout<<"Tohru"<<endl;
    42     }
    43     return 0;
    44 }
  • 相关阅读:
    面向对象七大设计原则
    S2第六章
    S2第四章
    大数据Hadoop——HDFS Shell操作
    大数据Hadoop——初识Hadoop
    ssh整合oracle数据源报错????
    关于Struts2的通配方法、转发重定向
    SSH实现ajax
    关于Struts2自动装配和访问Servlet API
    Oracle函数
  • 原文地址:https://www.cnblogs.com/Misuchii/p/10969795.html
Copyright © 2020-2023  润新知