結果
| 問題 |
No.438 Cwwプログラミング入門
|
| コンテスト | |
| ユーザー |
hanorver
|
| 提出日時 | 2016-10-28 23:28:25 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,700 bytes |
| コンパイル時間 | 802 ms |
| コンパイル使用メモリ | 70,908 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-24 20:03:19 |
| 合計ジャッジ時間 | 32,421 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 94 WA * 4 |
ソースコード
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdlib>
int main() {
long long x, y, z;
std::cin >> x >> y >> z;
int a, b, ma, mb, total;
ma = mb = 100000;
total = 100000;
for (a = -10000; a < 10000; a++) {
for (b = -10000; b < 10000; b++) {
if (a * x + b * y == z && abs(a) + abs(b) < total) {
total = abs(a) + abs(b);
ma = a;
mb = b;
}
}
}
if (total + (total - 1) > 10000) {
std::cout << "mourennaihasimasenn" << std::endl;
return 0;
}
if (ma > 0) {
for (int i = 0; i < abs(mb); i++) {
std::cout << "w";
}
for (int i = 0; i < abs(ma); i++) {
std::cout << "c";
}
for (int i = 0; i < abs(ma) - 1; i++) {
std::cout << "C";
}
if (mb < 0) {
for (int i = 0; i < abs(mb); i++) {
std::cout << "W";
}
} else {
for (int i = 0; i < abs(mb); i++) {
std::cout << "C";
}
}
} else {
for (int i = 0; i < abs(ma); i++) {
std::cout << "c";
}
for (int i = 0; i < abs(mb); i++) {
std::cout << "w";
}
for (int i = 0; i < abs(mb) - 1; i++) {
std::cout << "C";
}
if (ma < 0) {
for (int i = 0; i < abs(ma); i++) {
std::cout << "W";
}
} else {
for (int i = 0; i < abs(ma); i++) {
std::cout << "C";
}
}
}
std::cout << std::endl;
return 0;
}
hanorver