結果
問題 |
No.438 Cwwプログラミング入門
|
ユーザー |
![]() |
提出日時 | 2016-10-29 19:42:07 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,218 bytes |
コンパイル時間 | 1,378 ms |
コンパイル使用メモリ | 159,704 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-24 23:10:44 |
合計ジャッジ時間 | 6,406 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 90 WA * 3 RE * 5 |
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for(int i=0;i<n;i++) #define int long long using namespace std; typedef long long ll; int x, y, z; /* int extgcd(int a, int b, int& x, int& y) { int d = a; if (b != 0) { d = extgcd(b, a % b, y, x); y -= (a / b) * x; } else { x = 1; y = 0; } return d; } */ signed main() { cin >> x >> y >> z; if (x == 0 && y == 0 && z == 0) { cout << "ccW" << endl; } for (int a=-5000; a<=5000; a++) { if ((z - a * x) % y == 0) { int b = (z - a * x) / y; if (2 * abs(a) + 2 * abs(b) - 1 <= 10000) { //printf("a = %lld, b = %lld\n", a, b); if (a * b < 0) { if (a < 0) { rep(i,-a) cout << 'c'; rep(i,-a-1) cout << 'C'; rep(i,b) cout << 'w'; rep(i,b-1) cout << 'C'; cout << 'W' << endl; return 0; } else if (b < 0) { rep(i,-b) cout << 'w'; rep(i,-b-1) cout << 'C'; rep(i,a) cout << 'c'; rep(i,a-1) cout << 'C'; cout << 'W' << endl; return 0; } } else { rep(i,a) cout << 'c'; rep(i,a-1) cout << 'C'; rep(i,b) cout << 'w'; rep(i,b-1) cout << 'C'; cout << 'C' << endl; return 0; } } } } cout << "mourennaihasimasenn" << endl; }