結果

問題 No.438 Cwwプログラミング入門
ユーザー uenokuuenoku
提出日時 2016-11-19 01:22:41
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 2,472 bytes
コンパイル時間 615 ms
コンパイル使用メモリ 87,468 KB
実行使用メモリ 7,052 KB
最終ジャッジ日時 2023-08-17 13:53:03
合計ジャッジ時間 36,267 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 WA -
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 OLE -
testcase_05 OLE -
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 1 ms
4,380 KB
testcase_14 WA -
testcase_15 AC 2 ms
4,376 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 2 ms
4,380 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 1 ms
4,376 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 2 ms
4,380 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 2 ms
4,380 KB
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 2 ms
4,380 KB
testcase_39 WA -
testcase_40 AC 1 ms
4,376 KB
testcase_41 WA -
testcase_42 WA -
testcase_43 AC 1 ms
4,380 KB
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 AC 1 ms
4,376 KB
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 AC 2 ms
4,380 KB
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 AC 1 ms
4,376 KB
testcase_59 WA -
testcase_60 WA -
testcase_61 WA -
testcase_62 AC 1 ms
4,376 KB
testcase_63 WA -
testcase_64 WA -
testcase_65 AC 1 ms
4,376 KB
testcase_66 WA -
testcase_67 AC 1 ms
4,380 KB
testcase_68 AC 1 ms
4,376 KB
testcase_69 OLE -
testcase_70 OLE -
testcase_71 WA -
testcase_72 OLE -
testcase_73 WA -
testcase_74 OLE -
testcase_75 OLE -
testcase_76 AC 1 ms
4,376 KB
testcase_77 OLE -
testcase_78 OLE -
testcase_79 AC 2 ms
4,384 KB
testcase_80 OLE -
testcase_81 -- -
testcase_82 -- -
testcase_83 -- -
testcase_84 -- -
testcase_85 -- -
testcase_86 -- -
testcase_87 -- -
testcase_88 -- -
testcase_89 -- -
testcase_90 -- -
testcase_91 -- -
testcase_92 -- -
testcase_93 -- -
testcase_94 -- -
testcase_95 -- -
testcase_96 -- -
testcase_97 -- -
testcase_98 -- -
testcase_99 -- -
testcase_100 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "math.h"
#include <algorithm>
#include <complex>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>
#define ifor(i, a, b) for (int i = (a); i < (b); i++)
#define rfor(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
using namespace std;
typedef long double ld;
typedef long long int lli;
typedef long long int ll;
typedef complex<double> P;
const double eps = 1e-11;
int vex[4] = {1, 0, -1, 0};
int vey[4] = {0, 1, 0, -1};
typedef vector<double> Vec;
typedef vector<int> vec;
typedef vector<Vec> MAT;
typedef vector<vec> mat;
lli MOD = 1000000007;
#define MAX 200005
#define inf MAX
lli gcd(lli a, lli b)
{
    return b > a ? gcd(b, a) : (b == 0 ? a : gcd(b, a % b));
}
vector<pair<lli, lli>> l;
lli extgcd(lli a, lli b, lli& x, lli& y)
{
    lli g = a;
    x = 1;
    y = 0;
    if (b != 0)
        g = extgcd(b, a % b, y, x), y -= (a / b) * x;
    l.push_back(pair<lli, lli>(a, b));
    return g;
}
int main()
{
    lli x, y, z, tx = 0, ty = 0;
    cin >> x >> y >> z;
    //cout << extgcd(x, y, tx, ty) << endl;
    z % extgcd(x, y, tx, ty);
    //cerr << tx << ' ' << ty << endl;
    lli m = MOD;
    rep(i, l.size())
    {
        if (abs(l[i].first) + abs(l[i].second) < m) {
            m = abs(l[i].first) + abs(l[i].second);
            tx = l[i].first;
            ty = l[i].second;
        }
    }
    if (z % gcd(x, y) != 0) {
        cout << "NO" << endl;
    } else {
        tx *= (z / gcd(x, y));
        ty *= (z / gcd(x, y));
        if (tx > 0) {
            cout << "c";
            rep(i, tx - 1)
            {
                cout << "cC";
            }
        } else if (tx == 0) {
            cout << "ccW";
        } else {
            tx = -tx;
            rep(i, tx + 2)
            {
                cout << "c";
            }
            rep(i, tx + 1)
            {
                cout << "W";
            }
        }
        if (ty > 0) {
            cout << "w";
            rep(i, ty - 1)
            {
                cout << "wC";
            }

        } else if (ty == 0) {
            cout << "wwW";
        } else {
            ty = -ty;
            rep(i, ty + 2)
            {
                cout << "w";
            }
            rep(i, ty + 1)
            {
                cout << "W";
            }
        }
        cout << "C" << endl;
    }
}
0