結果
問題 | No.438 Cwwプログラミング入門 |
ユーザー |
![]() |
提出日時 | 2016-10-29 16:46:31 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,765 bytes |
コンパイル時間 | 981 ms |
コンパイル使用メモリ | 65,768 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-27 22:15:44 |
合計ジャッジ時間 | 4,183 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 97 WA * 1 |
ソースコード
#include <iostream> using namespace std; int abs(int x){ return x >= 0 ? x : -x; } int main(){ int x, y, z; cin >> x >> y >> z; if(z == 0){ cout << "ccW" << endl; return 0; } if(x == 0 && y == 0){ cout << "mourennaihasimasenn" << endl; return 0; } if(x && z % x == 0 && 2 * (z / x) - 1 <= 10000){ for(int i = 0; i < z / x; i++) cout << 'c'; for(int i = 0; i < z / x - 1; i++) cout << 'C'; cout << endl; return 0; } if(y && z % y == 0 && 2 * (z / y) - 1 <= 10000){ for(int i = 0; i < z / y; i++) cout << 'w'; for(int i = 0; i < z / y - 1; i++) cout << 'C'; cout << endl; return 0; } if(x == 0 || y == 0){ cout << "mourennaihasimasenn" << endl; return 0; } for(int i = -5000; i <= 5000; i++){ if((z - i * x) % y) continue; if(i > 0 && (z - i * x) / y > 0 && (i + (z - i * x) / y) * 2 - 1 <= 10000){ for(int j = 0; j < i; j++) cout << 'c'; for(int j = 0; j < i - 1; j++) cout << 'C'; for(int j = 0; j < (z - i * x) / y; j++) cout << 'w'; for(int j = 0; j < (z - i * x) / y; j++) cout << 'C'; cout << endl; return 0; }else if(i < 0 && (abs(i) + (z - i * x) / y) * 2 - 1 <= 10000){ for(int j = 0; j < abs(i); j++) cout << 'c'; for(int j = 0; j < (z - i * x) / y; j++) cout << 'w'; for(int j = 0; j < (z - i * x) / y - 1; j++) cout << 'C'; for(int j = 0; j < abs(i); j++) cout << 'W'; cout << endl; return 0; }else if((z - i * x) / y < 0 && (i + abs((z - i * x) / y)) * 2 + 3 <= 10000){ for(int j = 0; j < abs((z - i * x) / y) + 2; j++) cout << 'w'; for(int j = 0; j < abs((z - i * x) / y) + 1; j++) cout << 'W'; for(int j = 0; j < i; j++) cout << 'c'; for(int j = 0; j < i; j++) cout << 'C'; cout << endl; return 0; } } cout << "mourennaihasimasenn" << endl; }