結果
| 問題 | No.639 An Ordinary Sequence |
| コンテスト | |
| ユーザー |
@abcde
|
| 提出日時 | 2020-03-13 22:04:34 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 9 ms / 1,000 ms |
| コード長 | 584 bytes |
| 記録 | |
| コンパイル時間 | 1,326 ms |
| コンパイル使用メモリ | 179,648 KB |
| 実行使用メモリ | 11,776 KB |
| 最終ジャッジ日時 | 2026-06-05 20:08:26 |
| 合計ジャッジ時間 | 2,175 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 17 |
ソースコード
// ※※※ 解答不能 ※※※
// https://yukicoder.me/submissions/197554
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define repex(i, a, b, c) for(int i = a; i < b; i += c)
#define repx(i, a, b) repex(i, a, b, 1)
#define rep(i, n) repx(i, 0, n)
#define repr(i, a, b) for(int i = a; i >= b; i--)
LL n, a[1000009];
LL solve(LL x){
if(x <= 1000000) return a[x];
return solve(x / 3) + solve(x / 5);
}
int main(){
a[0] = 1;
repx(i, 1, 1000001) a[i] = a[i / 3] + a[i / 5];
scanf("%lld", &n);
printf("%lld\n", solve(n));
return 0;
}
@abcde