結果

問題 No.2246 1333-like Number
ユーザー ja14378ja14378
提出日時 2023-03-17 21:33:50
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 564 bytes
コンパイル時間 2,114 ms
コンパイル使用メモリ 201,440 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-18 14:02:11
合計ジャッジ時間 2,973 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 2 ms
4,348 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 AC 2 ms
4,348 KB
testcase_20 AC 2 ms
4,348 KB
testcase_21 AC 2 ms
4,348 KB
testcase_22 AC 2 ms
4,348 KB
testcase_23 AC 2 ms
4,348 KB
testcase_24 AC 2 ms
4,348 KB
testcase_25 AC 2 ms
4,348 KB
testcase_26 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:24:63: warning: 'b' may be used uninitialized [-Wmaybe-uninitialized]
   24 |     for (int i = 0; i < (n - 1)/36 + 1; i++) ans.push_back('0'+b);
      |                                                            ~~~^~
main.cpp:13:12: note: 'b' was declared here
   13 |     int a, b;
      |            ^
main.cpp:23:22: warning: 'a' may be used uninitialized [-Wmaybe-uninitialized]
   23 |     ans.push_back('0'+a);
      |                   ~~~^~
main.cpp:13:9: note: 'a' was declared here
   13 |     int a, b;
      |         ^

ソースコード

diff #

#include <bits/stdc++.h>
using ll = long long;
#define MOD 1000000007
#define Mod 998244353
const int MAX = 1000000005;
const long long INF = 1000000000000000005LL;
using namespace std;

int main() {
    ll n;
    cin >> n;
    int m = (n%36 == 0 ? 36 : n%36);
    int a, b;
    for (int i = 8; i >= 1; i--) {
        if (m <= i) {
            a = 9 - i;
            b = a + m;
            break;
        }
        m -= i;
    }
    string ans;
    ans.push_back('0'+a);
    for (int i = 0; i < (n - 1)/36 + 1; i++) ans.push_back('0'+b);
    cout << ans << endl;
}
0