結果

問題 No.438 Cwwプログラミング入門
ユーザー hiyokko2
提出日時 2016-10-29 19:25:54
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 1,159 bytes
コンパイル時間 1,321 ms
コンパイル使用メモリ 159,692 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-24 23:10:03
合計ジャッジ時間 10,411 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 52 WA * 41 RE * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;

	for (int a=-5000; a<=5000; a++) {
		if ((z - a * x) % y == 0) {
			int b = (z - a * x) / y;
			if (2 * a + 2 * b - 1 <= 10000) {
				//printf("a = %lld, b = %lld\n", a, b);
				if (a * b < 0) {
					if (a < 0) {
						rep(i,abs(a)) cout << 'c';
						rep(i,abs(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,abs(b)) cout << 'w';
						rep(i,abs(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;
}
0