結果
| 問題 |
No.632 穴埋め門松列
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-02-02 15:54:05 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 1,155 bytes |
| コンパイル時間 | 562 ms |
| コンパイル使用メモリ | 62,248 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-31 00:49:30 |
| 合計ジャッジ時間 | 1,078 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 |
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repR(i, n) for(int i = (n) - 1; i > -1; i--)
#define rep1(i, n) for(int i = 1; i < (int)(n + 1); i++)
#define rep1R(i, n) for(int i = (n); i > 0; i--)
#define ll long long
using namespace std;
bool is_kadomatu(int a1, int a2, int a3) {
return (a1 != a2 && a2 != a3 && a3 != a1) && ((a2 >= a1 && a2 >= a3) || (a2 <= a1 && a2 <= a3));
}
int main() {
int c1 = 0, c2 = 0, c3 = 0;
int pos;
string s;
cin >> s;
if (s != "?") c1 = stoi(s);
else pos = 1;
cin >> s;
if (s != "?") c2 = stoi(s);
else pos = 2;
cin >> s;
if (s != "?") c3 = stoi(s);
else pos = 3;
string result = "";
if (pos == 1) {
if (is_kadomatu(1, c2, c3)) result += "1";
if (is_kadomatu(4, c2, c3)) result += "4";
} else if (pos == 2) {
if (is_kadomatu(c1, 1, c3)) result += "1";
if (is_kadomatu(c1, 4, c3)) result += "4";
} else if (pos == 3) {
if (is_kadomatu(c1, c2, 1)) result += "1";
if (is_kadomatu(c1, c2, 4)) result += "4";
} else {
cout << "error" << endl;
}
cout << result << endl;
return 0;
}