結果

問題 No.438 Cwwプログラミング入門
ユーザー snrnsidy
提出日時 2025-09-18 00:29:11
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 2,198 bytes
コンパイル時間 2,056 ms
コンパイル使用メモリ 196,536 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-09-18 00:29:22
合計ジャッジ時間 10,579 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 73 WA * 17 RE * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;

    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';
                }
                for(int i=0;i<a-1;i++)
                {
                    s += 'C';
                }
                if(A < 0)
                {
                    for(int i=0;i<B;i++)
                    {
                        s += 'W';
                    }
                }
                else
                {
                    for(int i=0;i<B;i++)
                    {
                        s += 'C';
                    }
                }
                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';
                }
                for(int i=0;i<a-1;i++)
                {
                    s += 'C';
                }
                if(A < 0)
                {
                    for(int i=0;i<B;i++)
                    {
                        s += 'W';
                    }
                }
                else
                {
                    for(int i=0;i<B;i++)
                    {
                        s += 'C';
                    }
                }
                cout << s << '\n';
                return 0;
            }
        }
    }


    cout << "NO" << '\n';
	return 0;
} 
0