結果

問題 No.634 硬貨の枚数1
ユーザー koyoprokoyopro
提出日時 2020-07-19 00:32:40
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,116 bytes
コンパイル時間 1,100 ms
コンパイル使用メモリ 145,096 KB
実行使用メモリ 159,412 KB
最終ジャッジ日時 2023-08-21 06:42:09
合計ジャッジ時間 7,276 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
159,296 KB
testcase_01 AC 56 ms
159,140 KB
testcase_02 AC 54 ms
159,244 KB
testcase_03 AC 48 ms
159,204 KB
testcase_04 AC 48 ms
159,344 KB
testcase_05 AC 48 ms
159,200 KB
testcase_06 AC 49 ms
159,204 KB
testcase_07 AC 48 ms
159,288 KB
testcase_08 AC 48 ms
159,344 KB
testcase_09 AC 56 ms
159,236 KB
testcase_10 AC 46 ms
159,124 KB
testcase_11 AC 46 ms
159,076 KB
testcase_12 AC 45 ms
159,132 KB
testcase_13 AC 46 ms
159,220 KB
testcase_14 AC 46 ms
159,304 KB
testcase_15 AC 45 ms
158,960 KB
testcase_16 AC 46 ms
159,228 KB
testcase_17 AC 46 ms
159,304 KB
testcase_18 AC 44 ms
159,036 KB
testcase_19 AC 46 ms
159,128 KB
testcase_20 AC 45 ms
159,160 KB
testcase_21 AC 45 ms
159,312 KB
testcase_22 AC 45 ms
159,020 KB
testcase_23 AC 45 ms
159,204 KB
testcase_24 AC 45 ms
159,160 KB
testcase_25 AC 45 ms
159,156 KB
testcase_26 AC 44 ms
159,368 KB
testcase_27 AC 44 ms
159,260 KB
testcase_28 AC 45 ms
159,124 KB
testcase_29 AC 46 ms
159,028 KB
testcase_30 AC 44 ms
159,156 KB
testcase_31 AC 45 ms
159,228 KB
testcase_32 AC 45 ms
159,308 KB
testcase_33 AC 44 ms
159,064 KB
testcase_34 AC 46 ms
159,228 KB
testcase_35 AC 45 ms
159,036 KB
testcase_36 AC 46 ms
159,124 KB
testcase_37 AC 45 ms
159,092 KB
testcase_38 AC 45 ms
159,224 KB
testcase_39 AC 45 ms
158,972 KB
testcase_40 AC 46 ms
159,296 KB
testcase_41 AC 46 ms
159,152 KB
testcase_42 AC 45 ms
159,136 KB
testcase_43 AC 45 ms
159,260 KB
testcase_44 AC 46 ms
159,124 KB
testcase_45 AC 45 ms
159,156 KB
testcase_46 AC 46 ms
159,100 KB
testcase_47 AC 47 ms
159,328 KB
testcase_48 WA -
testcase_49 AC 45 ms
159,008 KB
testcase_50 AC 46 ms
159,220 KB
testcase_51 AC 46 ms
159,200 KB
testcase_52 AC 46 ms
159,256 KB
testcase_53 AC 45 ms
159,024 KB
testcase_54 AC 46 ms
159,136 KB
testcase_55 AC 46 ms
159,136 KB
testcase_56 AC 46 ms
159,212 KB
testcase_57 AC 45 ms
159,084 KB
testcase_58 AC 46 ms
159,324 KB
testcase_59 AC 47 ms
159,140 KB
testcase_60 AC 46 ms
159,076 KB
testcase_61 AC 46 ms
159,304 KB
testcase_62 AC 45 ms
159,040 KB
testcase_63 AC 46 ms
159,016 KB
testcase_64 AC 45 ms
159,208 KB
testcase_65 AC 45 ms
159,160 KB
testcase_66 AC 45 ms
159,208 KB
testcase_67 AC 46 ms
159,140 KB
testcase_68 AC 45 ms
159,232 KB
testcase_69 AC 45 ms
159,016 KB
testcase_70 AC 49 ms
159,068 KB
testcase_71 AC 44 ms
159,120 KB
testcase_72 AC 44 ms
159,116 KB
testcase_73 AC 44 ms
159,412 KB
testcase_74 AC 44 ms
159,128 KB
testcase_75 AC 45 ms
159,020 KB
testcase_76 AC 45 ms
159,132 KB
testcase_77 AC 46 ms
159,232 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
#define int long long
#define FOR(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--)
#define ALL(a) (a).begin(),(a).end()
#define UNIQUE_SORT(l) sort(ALL(l)); l.erase(unique(ALL(l)), l.end());
#define CONTAIN(a, b) find(ALL(a), (b)) != (a).end()
#define array2(type, x, y) array<array<type, y>, x>
#define vector2(type) vector<vector<type> >
#define out(...) printf(__VA_ARGS__)

int dxy[] = {0, 1, 0, -1, 0};

void solve();
signed main()
{
#if DEBUG
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}

/*================================*/

int N;
vector<int> C(2e7, 0); // SorDに入っている金額のチェック用

void solve() {
    cin>>N;
    
    int ans = 3;
    REP(i,N) {
        int n = i * (i+1) / 2;
        if (n > N) break;
        C[n] = 1;
        if (C[N-n]) ans = 2;
    }
    if (C[N]) ans = 1;
    cout << ans << endl;
}
0