結果
| 問題 | No.634 硬貨の枚数1 |
| コンテスト | |
| ユーザー |
しらっ亭
|
| 提出日時 | 2017-05-10 16:20:58 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 350 bytes |
| 記録 | |
| コンパイル時間 | 749 ms |
| コンパイル使用メモリ | 59,988 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-25 18:19:14 |
| 合計ジャッジ時間 | 3,007 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 41 WA * 34 |
ソースコード
// 想定WA解法(OEIS)
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int solve(int n) {
vector<int> T;
for (int t, i = 1; (t = i * (i + 1) / 2) <= n; i++) {
if (t == n) return 1;
}
if (n % 9 == 5 || n % 9 == 8) return 3;
return 2;
}
int main() {
int n;
cin >> n;
cout << solve(n) << endl;
}
しらっ亭