結果
| 問題 |
No.634 硬貨の枚数1
|
| コンテスト | |
| ユーザー |
ats5515
|
| 提出日時 | 2018-01-19 21:40:28 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 6 ms / 2,000 ms |
| コード長 | 585 bytes |
| コンパイル時間 | 995 ms |
| コンパイル使用メモリ | 86,272 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-25 18:39:32 |
| 合計ジャッジ時間 | 2,864 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 75 |
ソースコード
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
cin.tie(0);
ios::sync_with_stdio(false);
int N;
cin >> N;
set<int> st;
int x = 1;
int res = 3;
while (x*(x + 1) / 2 < 100000000) {
st.insert(x*(x + 1) / 2);
x++;
}
if (st.count(N) == 1) {
res = 1;
}
else {
for (auto s : st) {
if (st.count(N - s) == 1) {
res = 2;
}
}
}
cout << res << endl;
}
ats5515