結果
| 問題 |
No.634 硬貨の枚数1
|
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2025-11-16 11:25:38 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 617 bytes |
| コンパイル時間 | 1,422 ms |
| コンパイル使用メモリ | 162,488 KB |
| 実行使用メモリ | 7,852 KB |
| 最終ジャッジ日時 | 2025-11-16 11:25:42 |
| 合計ジャッジ時間 | 4,120 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 74 WA * 1 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
int n;
map<int, bool> vis;
signed main()
{
// freopen("coin.in", "r", stdin);
// freopen("coin.out", "w", stdout);
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n;
for (int i = 1; i * (i + 1) / 2 <= n; i++)
{
if (i * (i + 1) / 2 == n)
{
cout << 1 << "\n";
return 0;
}
vis[i * (i + 1) / 2] = 1;
if (vis.count(n - i * (i + 1) / 2))
{
cout << 2 << "\n";
return 0;
}
}
cout << 3;
}
vjudge1