結果

問題 No.438 Cwwプログラミング入門
ユーザー togari_takamototogari_takamoto
提出日時 2016-10-29 00:16:34
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 2,106 bytes
コンパイル時間 4,653 ms
コンパイル使用メモリ 148,548 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-08-16 10:07:56
合計ジャッジ時間 9,203 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,384 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,384 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 1 ms
4,384 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 1 ms
4,384 KB
testcase_13 AC 2 ms
4,384 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 2 ms
4,384 KB
testcase_16 AC 1 ms
4,384 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 2 ms
4,384 KB
testcase_19 AC 2 ms
4,384 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 2 ms
4,384 KB
testcase_22 AC 1 ms
4,384 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 2 ms
4,384 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 2 ms
4,380 KB
testcase_28 AC 1 ms
4,384 KB
testcase_29 AC 1 ms
4,380 KB
testcase_30 AC 2 ms
4,380 KB
testcase_31 AC 1 ms
4,380 KB
testcase_32 AC 2 ms
4,380 KB
testcase_33 AC 2 ms
4,380 KB
testcase_34 AC 2 ms
4,384 KB
testcase_35 AC 2 ms
4,380 KB
testcase_36 AC 1 ms
4,384 KB
testcase_37 AC 1 ms
4,384 KB
testcase_38 AC 1 ms
4,380 KB
testcase_39 AC 1 ms
4,384 KB
testcase_40 AC 1 ms
4,384 KB
testcase_41 AC 2 ms
4,380 KB
testcase_42 AC 2 ms
4,380 KB
testcase_43 RE -
testcase_44 AC 1 ms
4,384 KB
testcase_45 AC 2 ms
4,380 KB
testcase_46 AC 2 ms
4,384 KB
testcase_47 AC 2 ms
4,384 KB
testcase_48 AC 2 ms
4,380 KB
testcase_49 AC 1 ms
4,380 KB
testcase_50 AC 2 ms
4,380 KB
testcase_51 AC 2 ms
4,380 KB
testcase_52 AC 2 ms
4,380 KB
testcase_53 AC 1 ms
4,380 KB
testcase_54 AC 2 ms
4,380 KB
testcase_55 AC 1 ms
4,380 KB
testcase_56 AC 2 ms
4,384 KB
testcase_57 AC 2 ms
4,380 KB
testcase_58 AC 2 ms
4,380 KB
testcase_59 AC 2 ms
4,380 KB
testcase_60 AC 1 ms
4,380 KB
testcase_61 AC 1 ms
4,380 KB
testcase_62 AC 2 ms
4,380 KB
testcase_63 AC 2 ms
4,384 KB
testcase_64 AC 2 ms
4,384 KB
testcase_65 AC 2 ms
4,380 KB
testcase_66 AC 1 ms
4,380 KB
testcase_67 AC 2 ms
4,384 KB
testcase_68 WA -
testcase_69 AC 2 ms
4,380 KB
testcase_70 AC 2 ms
4,384 KB
testcase_71 AC 2 ms
4,384 KB
testcase_72 AC 2 ms
4,384 KB
testcase_73 AC 1 ms
4,384 KB
testcase_74 AC 2 ms
4,380 KB
testcase_75 AC 2 ms
4,380 KB
testcase_76 WA -
testcase_77 AC 1 ms
4,384 KB
testcase_78 AC 2 ms
4,380 KB
testcase_79 AC 2 ms
4,380 KB
testcase_80 AC 2 ms
4,380 KB
testcase_81 AC 2 ms
4,380 KB
testcase_82 AC 2 ms
4,380 KB
testcase_83 AC 2 ms
4,380 KB
testcase_84 AC 2 ms
4,380 KB
testcase_85 AC 2 ms
4,380 KB
testcase_86 AC 2 ms
4,380 KB
testcase_87 AC 2 ms
4,384 KB
testcase_88 RE -
testcase_89 AC 2 ms
4,384 KB
testcase_90 RE -
testcase_91 RE -
testcase_92 RE -
testcase_93 RE -
testcase_94 RE -
testcase_95 AC 2 ms
4,384 KB
testcase_96 AC 2 ms
4,380 KB
testcase_97 AC 2 ms
4,384 KB
testcase_98 AC 2 ms
4,384 KB
testcase_99 AC 2 ms
4,380 KB
testcase_100 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using u32 = uint32_t;
using vi = vector<int>;    using vvi = vector<vi>;
using vb = vector<bool>;   using vvb = vector<vb>;
using vl = vector<ll>;     using vvl = vector<vl>;
using vd = vector<double>; using vvd = vector<vd>;

#define REP(i,n) for(auto i = 0 * (n), i##_len = (n); i < i##_len; ++i)
#define ALL(c) (c).begin(), (c).end()
#define FOR(i,s,n) for(ll i=s, i##_len=(ll)(n); i<i##_len; ++i)
#define TEN(x) ((ll)1e##x)
const ll mod = TEN(9) + 7;

ll extgcd(ll a, ll b, ll *x, ll *y) {
	if (b == 0) return (*x = (a<0) ? -1 : 1), *y = 0, abs(a);
	ll d = extgcd(b, a%b, y, x);
	return *y -= a / b*(*x), d;
}

int main() {
#ifdef INPUT_FROM_FILE
	ifstream cin("sample.in");
	ofstream cout("sample.out");
#endif
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(50);
	ll a, b, c; cin >> a >> b >> c;
	REP(i, 6001) {
		auto cww = [&](ll x, ll y) {
			if (x == 0 && y == 0) return false;
			if (x < 0) {
				if (-x + y + max<ll>(0, y - 1) - x > 10000) return false;
			} else if (y < 0) {
				if (-y + x + max<ll>(0, x - 1) - y > 10000) return false;
			} else {
				if (x + y + max<ll>(0, x - 1 + y) > 10000) return false;
			}

			if (x < 0) {
				REP(i, -x) cout << 'c';
				REP(i, y) cout << 'w';
				REP(i, y - 1) cout << 'C';
				REP(i, -x) cout << 'W';
			} else if (y < 0) {
				REP(i, -y) cout << 'w';
				REP(i, x) cout << 'c';
				REP(i, x - 1) cout << 'C';
				REP(i, -y) cout << 'W';
			} else {
				REP(i, x) cout << 'c';
				REP(i, y) cout << 'w';
				REP(i, y + x - 1) cout << 'C';
			}
			return true;
		};
		{
			ll x = i;
			if ((c - x * a) % b == 0) {
				if (cww(x, (c - x * a) / b)) return 0;
			}
		}
		{
			ll x = -i;
			if ((c - x * a) % b == 0) {
				if (cww(x, (c - x * a) / b)) return 0;
			}
		}
		{
			ll y = i;
			if ((c - y * b) % a == 0) {
				if (cww((c - y * b) / a, y)) return 0;
			}
		}
		{
			ll y = -i;
			if ((c - y * b) % a == 0) {
				if (cww((c - y * b) / a, y)) return 0;
			}
		}
	}

	cout << "mourennaihasimasenn" << endl;

	return 0;
}
0