結果

問題 No.501 穴と文字列
ユーザー まいん-まいん-
提出日時 2017-04-07 22:55:33
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 1,378 bytes
コンパイル時間 866 ms
コンパイル使用メモリ 89,436 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-14 16:23:48
合計ジャッジ時間 1,569 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <stack>
#include <queue>
#include <functional>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <vector>
#include <array>
#include <tuple>
#include <utility>
#include <numeric>
#include <iomanip>
#include <cctype>
#include <cmath>
#include <assert.h>
#include <cstdlib>
#include <list>
using namespace std;

using ll = long long;
using ull = unsigned long long;
using PII = pair<int, int>;
using PLL = pair<ll, ll>;

template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {
    return s << "(" << p.first << ", " << p.second << ")";
}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
    s << "[";
    for (int i = 0; i < v.size(); i++) s << (i == 0 ? "" : ", ") << v[i];
    s << "]";
    return s;
}

#define ALL(a) (a).begin(), (a).end()

int main() {
    int n, d;
    cin >> n >> d;

    for (int b_num = 0; b_num <= n; b_num++) {
        int a_num = d - b_num * 2;
        if (a_num + b_num > n) continue;

        int c_num = n - a_num - b_num;
        for (int i = 0; i < a_num; i++) cout << "A";
        for (int i = 0; i < b_num; i++) cout << "B";
        for (int i = 0; i < c_num; i++) cout << "C";
        cout << endl;

        break;
    }

    return 0;
}
0