結果
| 問題 |
No.438 Cwwプログラミング入門
|
| コンテスト | |
| ユーザー |
togari_takamoto
|
| 提出日時 | 2016-10-29 00:43:22 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,752 bytes |
| コンパイル時間 | 1,183 ms |
| コンパイル使用メモリ | 159,732 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-27 22:07:27 |
| 合計ジャッジ時間 | 4,261 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 98 |
ソースコード
#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;
bool 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';
}
cout << endl;
return true;
}
int main() {
cin.tie(0);
ios_base::sync_with_stdio(false);
cout << fixed << setprecision(50);
ll a, b, c; cin >> a >> b >> c;
if (c == 0) {
cout << "ccW" << endl;
return 0;
}
REP(i, 5001) {
if (b && (c - i * a) % b == 0 && cww(i, (c - i * a) / b)) return 0;
if (b && (c + i * a) % b == 0 && cww(-i, (c + i * a) / b)) return 0;
if (a && (c - i * b) % a == 0 && cww((c - i * b) / a, i)) return 0;
if (a && (c + i * b) % a == 0 && cww((c + i * b) / a, -i)) return 0;
}
cout << "mourennaihasimasenn" << endl;
return 0;
}
togari_takamoto