結果

問題 No.2246 1333-like Number
ユーザー Xinyuan Huang
提出日時 2025-02-19 17:17:20
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 444 bytes
コンパイル時間 1,264 ms
コンパイル使用メモリ 160,108 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2025-02-19 17:17:23
合計ジャッジ時間 2,135 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:10: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions]
    8 |     auto [d, r] = std::div(n - 1, N);
      |          ^

ソースコード

diff #

#include <bits/stdc++.h>

constexpr int N = (1 + 8) * 8 / 2;

int main() {
    std::cin.tie(nullptr)->sync_with_stdio(false);
    int n; std::cin >> n;
    auto [d, r] = std::div(n - 1, N);
    for (int i = 0, a = 1; a <= 9; ++a)
        for (int b = a + 1; b <= 9; ++b, i += 1) {
            if (i == r)  {
                std::cout << a << std::string(d + 1, b + '0') << "\n";
                return 0;
            }
        }
    return 0;
}
0