結果
| 問題 |
No.438 Cwwプログラミング入門
|
| ユーザー |
|
| 提出日時 | 2025-09-18 00:42:40 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 3,736 bytes |
| コンパイル時間 | 2,018 ms |
| コンパイル使用メモリ | 199,212 KB |
| 実行使用メモリ | 7,720 KB |
| 最終ジャッジ日時 | 2025-09-18 00:42:47 |
| 合計ジャッジ時間 | 6,613 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 97 WA * 1 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
cin.tie(0);
ios::sync_with_stdio(false);
long long int x,y,z;
cin >> x >> y >> z;
if(z==0)
{
cout << "ccW" << '\n';
return 0;
}
if(x==0 && y==0)
{
cout << "NO" << '\n';
return 0;
}
if(x==0)
{
if(z%y!=0)
{
cout << "NO" << '\n';
}
else
{
long long int A = z/y;
if(2*A-1 <= 10000)
{
for(int i=0;i<A;i++) cout << 'w';
for(int i=0;i<A-1;i++) cout << 'C';
cout << '\n';
}
else
{
cout << "NO" << '\n';
}
}
return 0;
}
if(y==0)
{
if(z%x!=0)
{
cout << "NO" << '\n';
}
else
{
long long int A = z/x;
if(2*A-1 <= 10000)
{
for(int i=0;i<A;i++) cout << 'c';
for(int i=0;i<A-1;i++) cout << 'C';
cout << '\n';
}
else
{
cout << "NO" << '\n';
}
}
return 0;
}
for(long long int a=0;a<=10000;a++)
{
long long int A = z - (a*x);
if(abs(A)%y==0)
{
long long int B = abs(A)/y;
if(2*(A+B) - 1 <= 10000)
{
string s = "";
for(int i=0;i<B;i++)
{
s += 'w';
}
for(int i=0;i<a;i++)
{
s += 'c';
}
bool ok = true;
if(a==0) ok = false;
for(int i=0;i<a-1;i++)
{
s += 'C';
}
if(A < 0)
{
if(!ok) B-=1;
for(int i=0;i<B;i++)
{
s += 'W';
}
}
else
{
if(!ok) B-=1;
for(int i=0;i<B;i++)
{
s += 'C';
}
}
if(s.length() <= 10000)
{
cout << s << '\n';
return 0;
}
}
}
}
for(long long int a=0;a<=10000;a++)
{
long long int A = z - (a*y);
if(abs(A)%x==0)
{
long long int B = abs(A)/x;
if(2*(A+B) - 1 <= 10000)
{
string s = "";
for(int i=0;i<B;i++)
{
s += 'c';
}
for(int i=0;i<a;i++)
{
s += 'w';
}
bool ok = true;
if(a==0) ok = false;
for(int i=0;i<a-1;i++)
{
s += 'C';
}
if(A < 0)
{
if(!ok) B-=1;
for(int i=0;i<B;i++)
{
s += 'W';
}
}
else
{
if(!ok) B-=1;
for(int i=0;i<B;i++)
{
s += 'C';
}
}
if(s.length() <= 10000)
{
cout << s << '\n';
return 0;
}
}
}
}
cout << "NO" << '\n';
return 0;
}