結果

問題 No.24 数当てゲーム
ユーザー kuromaru613kuromaru613
提出日時 2019-03-03 19:37:31
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 2,204 bytes
コンパイル時間 651 ms
コンパイル使用メモリ 87,168 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-05 17:49:12
合計ジャッジ時間 1,384 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/*
    問題をよく読もう!
    論理的に考えよう!
    サンプルを確認しよう!
    絶対に諦めるな!
    工夫をしろ!
    配列は少し多めにとっておく

    Twitterは終わるまでログアウト!
    (間違えて解法をツイートしてはいけないから)

*/
//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include<cstring>
//namespace
using namespace std;
//繰り返し
#define REP(i, m, n) for(int i=(int)m; i<(int)n; ++i)
#define rep(i, n) REP(i, 0, n)
//イテレータ
#define all_range(C) begin(C), end(C)
//簡略化
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
typedef pair<string,int> pst;

const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
//最大最小
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) {if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) {if(a<b) a=b;}

//関数

//最大公約数を求める
ll my_gcd(ll x, ll y) {
  ll r;

  while(y!=0) {
    r = x%y;
    x = y;
    y = r;
  }

  return x;
}

//最小公約数を求める
ll my_lcm(ll x, ll y) {

  return (x*y)/my_gcd(x,y);
}

//xのy乗を求める ※参考:10^18乗まで
ll my_pow(ll x, ll y) {
  ll sum = 1;

  while(y>0) {
    sum *= x;
    --y;
  }

  return sum;
}

/*考えを書くスペース
  累乗和で解く

  ・総和を求める
  ・取り消すところの一つ先を見る
*/
//main.cpp----------------------------
#define max_n 6

void solve();

int n;
int f[10];

int main() {
  cin >> n;

  solve();

  return 0;
}

void solve() {

  int a, b, c, d;
  string r;
  rep(i, n) {
    cin >> a >> b >> c >> d >> r;
    if(r=="YES") {
      ++f[a]; ++f[b]; ++f[c]; ++f[d];
    }else if(r=="NO") {
      f[a]=f[b]=f[c]=f[d]=-1;
    }
  }
  int index = 0, max = -inf;
  rep(i, 10) {
    if(max<f[i]) {
      max = f[i];
      index = i;
    }
  }
  cout << index << endl;
}
0