結果
| 問題 | No.24 数当てゲーム |
| コンテスト | |
| ユーザー |
gotutiyan
|
| 提出日時 | 2018-01-03 12:45:10 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 1,683 bytes |
| コンパイル時間 | 1,187 ms |
| コンパイル使用メモリ | 83,348 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-23 01:40:53 |
| 合計ジャッジ時間 | 1,547 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:94:11: warning: 'num' may be used uninitialized [-Wmaybe-uninitialized]
94 | cout<<num<<endl;
| ^~~
main.cpp:87:14: note: 'num' was declared here
87 | int ma=0,num;
| ^~~
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <stack>
#include <functional>
#include <queue>
#include <cmath>
#define rep(i,j,k) for(int i=j;i<k;i++)
#define drep(n,m) for(int i=0;i<n;i++)for(int j=0;j<m;j++)
#define Sort(x) sort((x).begin(),(x).end())
#define fi first
#define se second
#define vi vector<int>
#define INF 1000000000
#define MOD 1000000009
#define pb push_back
#define mp make_pair
typedef long long ll;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
using namespace std;
ll gcd(ll a,ll b){
if(a<b){
int t=a;a=b;b=t;
}
int c=a%b;
while(c!=0){
a=b;
b=c;
c=a%b;
}
return b;
}
ll lcm(ll a,ll b){
return a*b/gcd(a,b);
}
bool isPrime(int x){
if(x==1)return false;
if(x==2)return true;
if(x%2==0)return false;
for(int i=3;i<=sqrt(x);i+=2){
if(x%i==0)return false;
}
return true;
}
int kaizyo(int x){
if(x==1)return x;
else return x*kaizyo(x-1);
}
typedef struct Point{
int x;
int y;
} P;
int main() {
int n;
vector<int> ans(10,0);
vector<int> v(4);
string s;
cin>>n;
rep(i,0,n){
rep(j,0,4)cin>>v[j];
cin>>s;
if(s=="NO"){
rep(j,0,10){
bool f=true;
rep(k,0,4){
if(v[k]==j)f=false;
}
if(f)ans[j]++;
}
}else if(s=="YES"){
rep(j,0,4){
ans[v[j]]++;
}
}
}
int ma=0,num;
rep(i,0,10){
if(ma<ans[i]){
ma=ans[i];
num=i;
}
}
cout<<num<<endl;
return 0;
}
gotutiyan