結果
| 問題 |
No.438 Cwwプログラミング入門
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-10-13 01:05:49 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 852 bytes |
| コンパイル時間 | 2,182 ms |
| コンパイル使用メモリ | 196,436 KB |
| 最終ジャッジ日時 | 2025-01-15 06:58:10 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 38 WA * 60 |
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
using lint=long long;
int main(){
lint a,b,c; cin>>a>>b>>c;
if(c==0){
cout<<"YES\nccW\n";
return 0;
}
rep(x,5001) if(a*x==c) {
cout<<"YES\n"<<string(x,'c')<<string(x-1,'C')<<"\n";
return 0;
}
rep(y,5001) if(b*y==c) {
cout<<"YES\n"<<string(y,'w')<<string(y-1,'C')<<"\n";
return 0;
}
for(int x=1;x<=5000;x++) for(int y=1;y<=5000-x;y++) {
if(a*x+b*y==c){
cout<<"YES\n"<<string(y,'w')<<string(y-1,'C')<<string(x,'c')<<string(x-1,'C')<<"C\n";
return 0;
}
if(a*x-b*y==c){
cout<<"YES\n"<<string(y,'w')<<string(y-1,'C')<<string(x,'c')<<string(x-1,'C')<<"W\n";
return 0;
}
if(-a*x+b*y==c){
cout<<"YES\n"<<string(x,'c')<<string(x-1,'C')<<string(y,'w')<<string(y-1,'C')<<"W\n";
return 0;
}
}
cout<<"NO\n";
return 0;
}