結果

問題 No.438 Cwwプログラミング入門
ユーザー hirokazu1020
提出日時 2016-10-28 23:32:05
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 1,526 bytes
コンパイル時間 954 ms
コンパイル使用メモリ 95,616 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-24 20:13:30
合計ジャッジ時間 12,458 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 41 WA * 57
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _CRT_SECURE_NO_WARNINGS
#include<sstream>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())








int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);

	long long x, y, z;
	cin >> x >> y >> z;
	string s;

	
	for (int i = -5000 + 1; i < 5000;i++) {
		for (int j = -5000 + 1 + abs(i); j < 5000 - abs(i); j++) {
			if (x*i + y*j == z) {
				if (i == 0 && j == 0) {
					continue;
				}
				int n = (abs(i) + abs(j)) * 2;
				if (i > 0 || j > 0)n--;
				else n += 3;
				if (n > 10000)continue;



				if (i > 0) {
					cout << 'c';
					rep(_, i - 1) {
						cout << "cC";
					}
					if (j > 0) {
						rep(_, j) {
							cout << "wC";
						}
					}
					else {
						rep(_, j) {
							cout << "wW";
						}
					}
				}
				else if (j > 0) {
					cout << 'w';
					rep(_, j - 1) {
						cout << "wC";
					}
					rep(_, i) {
							cout << "cW";
					}
				}
				else {
					cout << "ccW";
					rep(_, i) {
						cout << "cW";
					}
					rep(_, j) {
						cout << "wW";
					}
				}
				cout << endl;
				return 0;
			}
		}
	}
	
	cout << "mourennaihasimasenn" << endl;
	return 0;
}
0