結果
| 問題 |
No.438 Cwwプログラミング入門
|
| コンテスト | |
| ユーザー |
ldsyb
|
| 提出日時 | 2016-10-29 15:15:04 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,691 bytes |
| コンパイル時間 | 638 ms |
| コンパイル使用メモリ | 67,332 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-24 23:09:36 |
| 合計ジャッジ時間 | 5,109 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 88 WA * 10 |
ソースコード
#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((abs(i) + abs((z - i * x) / y)) * 2 + 3 > 10000) continue;
if(i > 0 && (z - i * x) / y > 0){
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){
for(int j = 0; j < abs(i) + 2; j++) cout << 'c';
for(int j = 0; j < abs(i) + 1; j++) cout << 'W';
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((z - i * x) / y < 0){
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 + 2; j++) cout << 'w';
for(int j = 0; j < (z - i * x) / y + 2; j++) cout << 'W';
cout << endl;
return 0;
}
}
cout << "mourennaihasimasenn" << endl;
}
ldsyb