結果
| 問題 |
No.438 Cwwプログラミング入門
|
| コンテスト | |
| ユーザー |
HO_RI1991
|
| 提出日時 | 2016-10-29 00:15:32 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,411 bytes |
| コンパイル時間 | 1,576 ms |
| コンパイル使用メモリ | 126,272 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-24 22:19:15 |
| 合計ジャッジ時間 | 10,314 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 55 WA * 43 |
ソースコード
#include<iostream>
#include<vector>
#include<string>
#include<array>
#include<algorithm>
#include<list>
#include<cmath>
#include<iomanip>
#include<queue>
#include<functional>
#include<climits>
#include<iterator>
#include<unordered_set>
#include<unordered_map>
#include<map>
#include<set>
#include<typeinfo>
#include<numeric>
#include<complex>
#include<memory>
#include<fstream>
#include<chrono>
#include<random>
using namespace std;
const double pi=4*atan(1.0);
constexpr long long mod=static_cast<long long>(1e9+7);
using cWeightEdges=vector<vector<pair<int,int>>>;
using cEdges=vector<vector<int>>;
int main(){
long long x,y,z;
cin>>x>>y>>z;
bool is_find=false;
long long n=1;
string ans;
if(z==0){
is_find=true;
ans="ccW";
}
else{
if(x==0 && y==0){
}
else if(x==0 && y!=0){
if(z%y==0 && 2*(z/y)-1<=10000){
is_find=true;
string s1(z/y,'w');
string s2(z/y-1,'C');
}
}
else if(x!=0 && y==0){
if(z%x==0 && 2*(z/x)-1<=10000){
is_find=true;
string s1(z/x,'c');
string s2(z/x-1,'C');
}
}
else{
while(2*(n-1)+1<=10000){
long long rest=z-n*x;
if(rest%y==0){
long long m=rest/y;
if(m==0){
if(2*n-1<=10000){
string s1(n,'c');
string s2(n-1,'C');
ans=s1+s2;
}
}
else{
if(2*n-1+2*abs(m)-1+1<=10000){
is_find=true;
string s1(n,'c');
string s2(n-1,'C');
string s3(abs(m),'w');
string s4(abs(m)-1,'C');
if(m>0){
ans+=s1+s2+s3+s4;
ans+="C";
}
else{
ans+=s1+s2+s3+s4;
ans+="W";
}
break;
}
}
}
++n;
}
n=1;
if(!is_find){
while(2*(n-1)+1<=10000){
long long rest=z-n*y;
if(rest%x==0){
long long m=rest/x;
if(m==0){
if(2*n-1<=10000){
string s1(n,'w');
string s2(n-1,'C');
ans=s1+s2;
}
}
else{
if(2*n-1+2*abs(m)-1+1<=10000){
is_find=true;
string s1(n,'w');
string s2(n-1,'C');
string s3(abs(m),'c');
string s4(abs(m)-1,'C');
if(m>0){
ans+=s1+s2+s3+s4;
ans+="C";
}
else{
ans+=s1+s2+s3+s4;
ans+="W";
}
break;
}
}
}
++n;
}
}
}
}
if(is_find)cout<<ans<<endl;
else cout<<"mourennaihasimasenn"<<endl;
system("pause");
return 0;
}
HO_RI1991