結果
問題 | No.438 Cwwプログラミング入門 |
ユーザー | moyashi_senpai |
提出日時 | 2016-10-29 00:08:17 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 461 ms / 2,000 ms |
コード長 | 1,564 bytes |
コンパイル時間 | 1,597 ms |
コンパイル使用メモリ | 98,316 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-27 21:52:26 |
合計ジャッジ時間 | 49,447 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 98 |
ソースコード
#include <iostream>#include <cstdio>#include <vector>#include <cmath>#include <cstring>#include <numeric>#include <algorithm>#include <functional>#include <array>#include <map>#include <queue>#include <limits.h>#include <set>#include <stack>#include <random>#define rep(i,s,n) for(long long i = (s); (n) > i; i++)#define REP(i,n) rep(i,0,n)#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))#define POWT(x) ((x)*(x))#define ALL(x) (x).begin(), (x).end()#define MODI 10000#define bitcheck(a,b) ((a >> b) & 1)#define bitset(a,b) ( a |= (1 << b))#define bitunset(a,b) (a &= ~(1 << b))using namespace std;typedef pair<int, int> pii;typedef long long ll;signed main() {ll x, y, z;scanf("%lld %lld %lld", &x, &y, &z);if (z == 0) {printf("ccW\n");return 0;}ll ax = 50000, ay = 50000;REP(i, 20002) {REP(j, 20002) {if (((i - 10001)*x + (j - 10001)*y) == z) {if ((abs(ax) + abs(ay)) > (abs(i - 10001) + abs(j - 10001))) {ax = i - 10001;ay = j - 10001;}}}}if (ax == 50000) {printf("mourennaihasimasenn\n");return 0;}string ans;REP(i, -ax) {ans += "c";}REP(i, -ay) {ans += "w";}REP(i, ax) {ans += "c";}REP(i, ay) {ans += "w";}int Csum = 0, Wsum = 0;if (ax > 0) Csum += ax;if (ay > 0) Csum += ay;Csum--;if (ax < 0) Wsum += -ax;if (ay < 0) Wsum += -ay;REP(i, Csum) {ans += "C";}REP(i, Wsum) {ans += "W";}if (ans.length() > 10000) {printf("mourennaihasimasenn\n");}else printf("%s\n", ans.c_str());return 0;}