結果
| 問題 |
No.438 Cwwプログラミング入門
|
| コンテスト | |
| ユーザー |
hirokazu1020
|
| 提出日時 | 2016-10-28 23:42:48 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,697 bytes |
| コンパイル時間 | 945 ms |
| コンパイル使用メモリ | 96,156 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-24 20:43:01 |
| 合計ジャッジ時間 | 11,726 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 44 WA * 54 |
ソースコード
#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;
for (int i = -5000; i <= 5000;i++) {
for (int j = -5000 + 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;
string num, op;
if (i > 0) {
num+= 'c';
rep(_, i - 1) {
num += 'c';
op += 'C';
}
if (j > 0) {
rep(_, j) {
num += 'w';
op += 'C';
}
}
else {
rep(_, j) {
num += 'w';
op += 'W';
}
}
}
else if (j > 0) {
num += 'w';
rep(_, j - 1) {
num += 'w';
op += 'C';
}
rep(_, i) {
num += 'c';
op += 'W';
}
}
else {
num += 'c';
num += 'c';
op += 'W';
rep(_, i) {
num += 'c';
op += 'W';
}
rep(_, j) {
num += 'w';
op += 'W';
}
}
reverse(all(num));
cout << num << op << endl;
return 0;
}
}
}
cout << "mourennaihasimasenn" << endl;
return 0;
}
hirokazu1020