結果
問題 |
No.634 硬貨の枚数1
|
ユーザー |
|
提出日時 | 2018-01-19 21:31:19 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 473 bytes |
コンパイル時間 | 816 ms |
コンパイル使用メモリ | 72,448 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-25 18:37:45 |
合計ジャッジ時間 | 3,051 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 61 WA * 14 |
ソースコード
#include <iostream> #include <algorithm> #include <vector> using namespace std; int main() { long long n; cin >> n; vector<long long> a; for (long long i = 1; i < 10000; i++) { a.push_back(i * (i + 1) / 2); } if (binary_search(a.begin(), a.end(), n)) { cout << 1 << endl; } else { for (long long x : a) { if (binary_search(a.begin(), a.end(), n)) { cout << 2 << endl; return 0; } } cout << 3 << endl; } }