結果

問題 No.634 硬貨の枚数1
ユーザー rogi52rogi52
提出日時 2022-10-21 03:05:58
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 21 ms / 2,000 ms
コード長 514 bytes
コンパイル時間 2,171 ms
コンパイル使用メモリ 199,556 KB
実行使用メモリ 42,228 KB
最終ジャッジ日時 2023-09-13 06:31:32
合計ジャッジ時間 6,326 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 3 ms
6,048 KB
testcase_15 AC 17 ms
36,140 KB
testcase_16 AC 9 ms
17,428 KB
testcase_17 AC 11 ms
20,640 KB
testcase_18 AC 9 ms
17,172 KB
testcase_19 AC 9 ms
32,592 KB
testcase_20 AC 11 ms
38,116 KB
testcase_21 AC 18 ms
40,380 KB
testcase_22 AC 17 ms
35,376 KB
testcase_23 AC 9 ms
15,888 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 1 ms
4,380 KB
testcase_26 AC 1 ms
4,376 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 2 ms
4,376 KB
testcase_29 AC 2 ms
4,376 KB
testcase_30 AC 1 ms
4,376 KB
testcase_31 AC 2 ms
4,380 KB
testcase_32 AC 2 ms
4,376 KB
testcase_33 AC 2 ms
4,380 KB
testcase_34 AC 4 ms
5,400 KB
testcase_35 AC 6 ms
13,540 KB
testcase_36 AC 13 ms
25,540 KB
testcase_37 AC 11 ms
18,452 KB
testcase_38 AC 5 ms
6,860 KB
testcase_39 AC 17 ms
34,724 KB
testcase_40 AC 12 ms
24,460 KB
testcase_41 AC 11 ms
22,724 KB
testcase_42 AC 16 ms
33,000 KB
testcase_43 AC 8 ms
15,408 KB
testcase_44 AC 2 ms
4,376 KB
testcase_45 AC 2 ms
4,376 KB
testcase_46 AC 4 ms
7,088 KB
testcase_47 AC 13 ms
42,228 KB
testcase_48 AC 1 ms
4,380 KB
testcase_49 AC 3 ms
6,832 KB
testcase_50 AC 20 ms
42,172 KB
testcase_51 AC 4 ms
6,876 KB
testcase_52 AC 1 ms
4,376 KB
testcase_53 AC 1 ms
4,376 KB
testcase_54 AC 1 ms
4,376 KB
testcase_55 AC 19 ms
41,508 KB
testcase_56 AC 20 ms
41,380 KB
testcase_57 AC 19 ms
40,984 KB
testcase_58 AC 21 ms
40,684 KB
testcase_59 AC 20 ms
40,668 KB
testcase_60 AC 20 ms
40,064 KB
testcase_61 AC 19 ms
40,644 KB
testcase_62 AC 19 ms
40,228 KB
testcase_63 AC 19 ms
40,940 KB
testcase_64 AC 19 ms
40,880 KB
testcase_65 AC 19 ms
39,864 KB
testcase_66 AC 20 ms
41,440 KB
testcase_67 AC 19 ms
40,968 KB
testcase_68 AC 19 ms
40,820 KB
testcase_69 AC 19 ms
40,872 KB
testcase_70 AC 20 ms
40,664 KB
testcase_71 AC 20 ms
40,592 KB
testcase_72 AC 20 ms
40,188 KB
testcase_73 AC 20 ms
40,112 KB
testcase_74 AC 19 ms
39,604 KB
testcase_75 AC 19 ms
39,648 KB
testcase_76 AC 2 ms
4,376 KB
testcase_77 AC 4 ms
10,748 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);

    int N; cin >> N;
    vector<int> isT(N + 1, 0);
    for(int i = 1; i * (i + 1) / 2 <= N; i++) isT[i * (i + 1) / 2] = 1;
    if(isT[N]) {
        cout << 1 << endl;
    } else {
        for(int i = 1; i <= N; i++) if(isT[i] && isT[N - i]) {
            cout << 2 << endl;
            return 0;
        }
        cout << 3 << endl;
    }
}
0