結果
| 問題 |
No.438 Cwwプログラミング入門
|
| コンテスト | |
| ユーザー |
tossy
|
| 提出日時 | 2016-10-28 23:17:52 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 1,455 bytes |
| コンパイル時間 | 748 ms |
| コンパイル使用メモリ | 94,320 KB |
| 実行使用メモリ | 830,944 KB |
| 最終ジャッジ日時 | 2024-11-24 19:47:39 |
| 合計ジャッジ時間 | 67,876 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 46 WA * 25 RE * 2 TLE * 15 MLE * 10 |
ソースコード
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <functional>
using namespace std;
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<(x)<<endl
#define fi first
#define se second
#define INF 2147483600
const string muri = "mourennaihasimasenn";
// a*x + b*y = gcd(a, b)
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;
}
int main(){
int x,y,z;
cin>>x>>y>>z;
int a,b;
int g = extgcd(x, y, a, b);
// ax + by = g
if(z%g!=0){
cout<<muri<<endl;
return 0;
}
string push="", pop="";
if(a<0){
rep(i,-a) push += "c";
rep(i,-a) pop += "W";
}
if(b<0){
rep(i,-b) push += "w";
rep(i,-b) pop += "W";
}
if(a>0){
rep(i,a) push += "c";
rep(i,a) pop = "C"+pop;
}
if(b>0){
rep(i,b) push += "w";
rep(i,b) pop = "C"+pop;
}
pop = pop.substr(1);
string res="";
rep(i,z/g){
res += push + pop;
if(i!=0) res += "C";
}
if(res.size()>10000) cout<<muri<<endl;
else cout<<res<<endl;
// 0入力のチェック!
return 0;
}
tossy