結果
問題 |
No.634 硬貨の枚数1
|
ユーザー |
![]() |
提出日時 | 2019-08-24 19:21:49 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 509 bytes |
コンパイル時間 | 1,416 ms |
コンパイル使用メモリ | 171,152 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-14 13:12:13 |
合計ジャッジ時間 | 3,529 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 WA * 66 |
ソースコード
#include "bits/stdc++.h" using namespace std; typedef long long ll; void Say(bool say, string a = "Yes", string b = "No"){cout << (say ? a : b) << endl;}; int main(){ set<ll>S; for(ll i = 1; ; i++){ ll t = i * (i + 1) / 2; if(t > 10000000)break; S.insert(t); } ll N; cin >> N; ll ans = 0; while(N){ set<ll>::iterator it = S.lower_bound(N); if(*it > N)it--; N -= (*it); ans++; } cout << ans << endl; return 0; }