結果
| 問題 |
No.143 豆
|
| コンテスト | |
| ユーザー |
cympfh
|
| 提出日時 | 2015-08-15 17:31:26 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 2,056 bytes |
| コンパイル時間 | 1,338 ms |
| コンパイル使用メモリ | 158,836 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-23 10:21:18 |
| 合計ジャッジ時間 | 1,975 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 17 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define loop for(;;)
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;
#define inf (1e9)
#define eps (1e-9)
template<class S, class T> inline
ostream& operator<<(ostream&os, pair<S,T> p) {
return os << '(' << p.first << ", " << p.second << ')';
}
template<class S, class T, class U> inline
ostream& operator<<(ostream&os, tuple<S,T,U> t) {
return os << '('
<< get<0>(t) << ", "
<< get<1>(t) << ", "
<< get<2>(t) << ')';
}
template<class T> inline
ostream& operator<<(ostream&os, vector<T> v) {
if (v.size() == 0) { return os << "(empty)"; }
os << v[0];
for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
return os;
}
template<class T> inline
istream& operator>>(istream&is, vector<T>&v) {
rep (i, v.size()) is >> v[i];
return is;
}
// ^ > v <
int dx[] = { -1, 0, 1, 0 };
int dy[] = { 0, 1, 0, -1 };
typedef vector<int> vi;
int san = 0, ni = 0;
inline bool fullhouse(vi&xs) { return (san == 1) and (ni == 1); }
inline bool three(vi&xs) { return (san == 1) and (ni == 0); }
inline bool two(vi&xs) { return (san == 0) and (ni == 2); }
inline bool one(vi&xs) { return (san == 0) and (ni == 1); }
int main() {
cin.tie(0);
ios::sync_with_stdio(0);
cout.setf(ios::fixed);
cout.precision(10);
int k, n, f; cin >> k >> n >> f;
int sum = 0;
rep (i, f) { int x; cin >> x; sum += x; }
int ans = k*n-sum;
if (ans < 0) ans = -1;
cout << ans << endl;
return 0;
int a,b,c,d,e;
cin >> a >> b >> c >> d >> e;
{
int memo[20] = {0};
vi xs = {a,b,c,d,e};
for (int x: xs) memo[x]++;
rep (i, 20) if (memo[i] == 2) ++ni; else if (memo[i] == 3) ++san;
if (fullhouse(xs)) {
cout << "FULL HOUSE" << endl;
} else if (three(xs)) {
cout << "THREE CARD" << endl;
} else if (two(xs)) {
cout << "TWO PAIR" << endl;
} else if (one(xs)) {
cout << "ONE PAIR" << endl;
} else {
cout << "NO HAND" << endl;
}
}
return 0;
}
cympfh