結果
| 問題 |
No.438 Cwwプログラミング入門
|
| コンテスト | |
| ユーザー |
Lepton_s
|
| 提出日時 | 2016-10-28 23:00:24 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,383 bytes |
| コンパイル時間 | 718 ms |
| コンパイル使用メモリ | 88,192 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-24 18:34:30 |
| 合計ジャッジ時間 | 5,401 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 90 RE * 8 |
ソースコード
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<25;
typedef pair<int,int> P;
typedef long long ll;
typedef unsigned long long ull;
#define N 10000
string ng = "mourennaihasimasenn";
int main(){
ll x, y, z;
cin>>x>>y>>z;
if(z==0){
cout<<"wwW"<<endl;
return 0;
}
ll g = __gcd(x, y);
if((x==0&&y==0) || z%g){
cout<<ng<<endl;
return 0;
}
x /= g; y /= g; z /= g;
if(x*y==0){
ll m = max(x, y);
ll c = z/m;
if(c*2-1>N){
cout<<ng<<endl;
return 0;
}
cout<<string(c, x>y?'c':'w')+string(c-1, 'C')<<endl;
return 0;
}
for(int i = -N/2; i <= N/2; i++){
ll z2 = z-i*x;
ll c = z2/y;
ll d = abs(i)+abs(c);
if(z2%y || d*2-1>N) continue;
if(i<0){
cout<<string(-i, 'c')+string(c, 'w')+string(c-1, 'C')+string(-i, 'W')<<endl;
} else if(c>0){
cout<<string(i, 'c')+string(c, 'w')+string(d-1, 'C')<<endl;
} else {
cout<<string(-c, 'w')+string(c, 'c')+string(i-1, 'C')+string(-c, 'W')<<endl;
}
return 0;
}
cout<<ng<<endl;
return 0;
}
Lepton_s