結果
問題 |
No.438 Cwwプログラミング入門
|
ユーザー |
![]() |
提出日時 | 2016-05-04 22:03:55 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,076 bytes |
コンパイル時間 | 1,590 ms |
コンパイル使用メモリ | 169,144 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-24 18:12:28 |
合計ジャッジ時間 | 7,720 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 64 WA * 34 |
ソースコード
/* * Problem link * http://yukicoder.me/problems/1100 */ #include<bits/stdc++.h> using namespace std; struct INIT{INIT(){cin.tie(0);ios_base::sync_with_stdio(false);} }init; typedef long long LL; inline bool inner(LL x,LL lb,LL ub) { return(lb <= x && x <= ub); } #define SZ 10000 int main() { #ifdef INPUT_FROM_FILE ifstream cin("sample.in"); ofstream cout("sample.out"); #endif LL x, y, z; cin >> x >> y >> z; assert(inner(x, 0, 100000000)); assert(inner(y, 0, 100000000)); assert(inner(z, 0, 100000000)); /*多分分けなくてもいいけどz=0は分けたほうが楽だと思います.*/ if (z == 0) cout << "ccW" << endl; /*これは分けないと多分事故る*/ else if (x == 0 && y ==0) cout << "mourennaihasimasenn" << endl; else if (x == 0) { if (z%y == 0 && (z / y) * 2 - 1 <= SZ) { for (int i = 0; i < (z / y); i++)cout << 'w'; for (int i = 1; i < (z / y); i++)cout << 'C'; cout << endl; } else cout << "mourennaihasimasenn" << endl; } else if (y == 0) { if (z%x == 0 && (z / x) * 2 - 1 <= SZ) { for (int i = 0; i < (z / x); i++)cout << 'c'; for (int i = 1; i < (z / x); i++)cout << 'C'; cout << endl; } else cout << "mourennaihasimasenn" << endl; } else { for (int n = 1; n <= 5000; n++) { if ((z - n * x) % y == 0 && ((z - n * x) / y) * 2 + n * 2 - 1 <= SZ) { for (int i = 0; i < ((z - n * x) / y); i++)cout << 'w'; for (int i = 0; i < n; i++)cout << 'c'; for (int i = 1; i < n; i++)cout << 'C'; for (int i = 0; i < ((z - n * x) / y); i++) if (z - n*x < 0)cout << 'W'; else cout << 'C'; cout << endl; return 0; } if ((z - n * y) % x == 0 && ((z - n * y) / x) * 2 + n * 2 - 1 <= SZ) { for (int i = 0; i < ((z - n * y) / x); i++)cout << 'c'; for (int i = 0; i < n; i++)cout << 'w'; for (int i = 1; i < n; i++)cout << 'C'; for (int i = 0; i < ((z - n * y) / x); i++) if (z - n*y < 0)cout << 'W'; else cout << 'C'; cout << endl; return 0; } } cout << "mourennaihasimasenn" << endl; } return 0; }