結果
| 問題 | No.634 硬貨の枚数1 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-01-20 01:30:15 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 9 ms / 2,000 ms |
| コード長 | 569 bytes |
| 記録 | |
| コンパイル時間 | 1,156 ms |
| コンパイル使用メモリ | 181,972 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-05-31 13:36:52 |
| 合計ジャッジ時間 | 3,619 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 75 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
vector<int> a;
for (int i = 1; i * (i + 1) / 2 <= n; i++) {
a.push_back(i * (i + 1) / 2);
if (a.back() == n) {
cout << 1 << endl;
return 0;
}
}
for (int x : a) {
for (int y : a) {
if (x + y == n) {
cout << 2 << endl;
return 0;
}
}
}
cout << 3 << endl;
return 0;
}