結果
| 問題 |
No.634 硬貨の枚数1
|
| コンテスト | |
| ユーザー |
ei1333333
|
| 提出日時 | 2018-01-19 21:37:15 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 19 ms / 2,000 ms |
| コード長 | 511 bytes |
| コンパイル時間 | 2,193 ms |
| コンパイル使用メモリ | 195,928 KB |
| 最終ジャッジ日時 | 2025-01-05 07:42:09 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 75 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
const int INF = 1 << 30;
int main()
{
int N;
cin >> N;
vector< int > vs;
for(int i = 1; i * (i + 1) / 2 <= N; i++) {
int cost = i * (i + 1) / 2;
vs.push_back(cost);
}
for(auto &p : vs) {
if(N == p) {
cout << 1 << endl;
return (0);
}
}
for(auto &p : vs) {
for(auto &q : vs) {
if(N == p + q) {
cout << 2 << endl;
return (0);
}
}
}
cout << 3 << endl;
}
ei1333333