結果

問題 No.438 Cwwプログラミング入門
ユーザー 10_oh_fu
提出日時 2016-10-28 23:58:19
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
RE  
実行時間 -
コード長 1,772 bytes
コンパイル時間 787 ms
コンパイル使用メモリ 90,488 KB
実行使用メモリ 14,188 KB
最終ジャッジ日時 2024-11-24 21:26:17
合計ジャッジ時間 8,471 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 87 WA * 3 RE * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring> 
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
 
using namespace std;

#define mod 1000000007

int main()
{
    int x, y, z;
    cin >> x >> y >> z;
    for(int xnum = 1; xnum < 10000; xnum++){
        if(abs(z - x * xnum) % y != 0) continue;
        int ynum = (z - x * xnum) / y;
        if(ynum == 0) continue;
        int tmpy = abs(ynum);
        string first(tmpy, 'w');
        string second(xnum, 'c');
        string third(xnum - 1, 'C');
        string fourth;
        if(ynum < 0){
            string tmp(-ynum, 'W');
            fourth = tmp;
        } else {
            string tmp(ynum, 'C');
            fourth = tmp;
        }
        string ans = first + second + third + fourth;
        if(ans.length() > 10000) continue;
        cout << ans << endl;
        return 0;
    }
    swap(x, y);
    for(int xnum = 1; xnum < 10000; xnum++){
        if(abs(z - x * xnum) % y != 0) continue;
        int ynum = (z - x * xnum) / y;
        if(ynum == 0) continue;
        int tmpy = abs(ynum);
        string first(tmpy, 'c');
        string second(xnum, 'w');
        string third(xnum - 1, 'C');
        string fourth;
        if(ynum < 0){
            string tmp(-ynum, 'W');
            fourth = tmp;
        } else {
            string tmp(ynum, 'C');
            fourth = tmp;
        }
        string ans = first + second + third + fourth;
        if(ans.length() > 10000) continue;
        cout << ans << endl;
        return 0;
    }
    cout << "mourennaihasimasenn" << endl;
    return 0;
}
0