結果

問題 No.634 硬貨の枚数1
ユーザー ei1333333
提出日時 2018-01-19 21:28:30
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 377 bytes
コンパイル時間 3,816 ms
コンパイル使用メモリ 195,496 KB
最終ジャッジ日時 2025-01-05 07:41:58
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9 WA * 66
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

using int64 = long long;

int main()
{
  int N;
  cin >> N;

  vector< int > vs;
  for(int i = 1; i * (i + 1) / 2 <= N; i++) {
    vs.push_back(i * (i + 1) / 2);
  }

  int ret = 0;
  while(N > 0) {
    int last = 0;
    for(auto &p : vs) {
      if(N >= p) last = p;
    }
    N -= last;
    ++ret;
  }
  cout << ret << endl;

}
0