結果

問題 No.634 硬貨の枚数1
ユーザー ミドリムシ
提出日時 2018-01-19 21:59:09
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 423 bytes
コンパイル時間 616 ms
コンパイル使用メモリ 65,268 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-25 18:54:40
合計ジャッジ時間 2,782 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9 WA * 66
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
using namespace std;

int main(){
    int N;
    cin >> N;
    int ans = 0;
    while(N){
        int triangular_number = 0;
        for(int i = 1; true; i++){
            triangular_number += i;
            if(triangular_number > N){
                N -= triangular_number - i;
                ans++;
                break;
            }
        }
    }
    cout << ans << endl;
}
0