結果
| 問題 |
No.438 Cwwプログラミング入門
|
| コンテスト | |
| ユーザー |
nasadigital
|
| 提出日時 | 2016-10-30 14:07:38 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,650 bytes |
| コンパイル時間 | 1,295 ms |
| コンパイル使用メモリ | 160,036 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-24 23:35:23 |
| 合計ジャッジ時間 | 10,134 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 56 WA * 35 RE * 7 |
ソースコード
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
void print(char f,char s,int a,int b,bool del){
for(int ctr1=0;ctr1<a;ctr1++)
cout<<f;
for(int ctr1=0;ctr1<b;ctr1++)
cout<<s;
if(del){
for(int ctr1=1;ctr1<b;ctr1++)
cout<<'C';
if(b>=1)
cout<<'W';
for(int ctr1=1;ctr1<a;ctr1++)
cout<<'C';
}
else{
for(int ctr1=1;ctr1<a+b;ctr1++)
cout<<'C';
}
}
int main()
{
ll x,y,z;
cin>>x>>y>>z;
if(z==0){
cout<<"ccW";
return 0;
}
ll t,t2;
for(int ctr1=1;ctr1<=5000;ctr1++){
t=z-x*ctr1;
if(t<0){
t=-t;
if(t%y==0){
t2=t/y;
if(ctr1+t2<=5000){
print('c','w',ctr1,t2,true);
return 0;
}
}
}
else if(t%y==0){
t2=t/y;
if(ctr1+t2<=5000){
print('c','w',ctr1,t2,false);
return 0;
}
}
}
swap(x,y);
for(int ctr1=1;ctr1<=5000;ctr1++){
t=z-x*ctr1;
if(t<0){
t=-t;
if(t%y==0){
t2=t/y;
if(ctr1+t2<=5000){
print('w','c',ctr1,t2,true);
return 0;
}
}
}
else if(t%y==0){
t2=t/y;
if(ctr1+t2<=5000){
print('w','c',ctr1,t2,false);
return 0;
}
}
}
cout<<"NO";
return 0;
}
nasadigital