結果

問題 No.632 穴埋め門松列
ユーザー nmnmnmnmnmnmnmnmnmnmnmnmnmnm
提出日時 2018-01-19 21:30:12
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 1,305 bytes
コンパイル時間 802 ms
コンパイル使用メモリ 96,336 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-26 00:02:00
合計ジャッジ時間 1,282 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iomanip>
using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=(b-1);i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

ll isKadomatsu(ll a, ll b, ll c) {
	vector<ll> v;
	v.pb(a); v.pb(b); v.pb(c);
	sort(all(v));
	if (v[0] == b || v[2] == b)return 1;
	return 0;
}

long long ston(string s) {
	long long n;
	sscanf(s.c_str(), "%lld", &n);
	return n;
}

int main() {
	vector<string> v(3, string());
	cin >> v[0] >> v[1] >> v[2];
	ll a[2] = {1, 4};
	rep(t, 0, 2) {
		ll d[3];
		rep(i, 0, v.sz) {
			if (v[i] == "?") {
				d[i] = a[t];
			}
			else {
				d[i] = ston(v[i]);
			}
		}
		if (isKadomatsu(d[0], d[1], d[2]) == 1)cout << a[t];
	}
	return 0;
}
0