結果
問題 | No.639 An Ordinary Sequence |
ユーザー |
![]() |
提出日時 | 2020-03-13 22:04:34 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 11 ms / 1,000 ms |
コード長 | 584 bytes |
コンパイル時間 | 1,310 ms |
コンパイル使用メモリ | 159,724 KB |
実行使用メモリ | 11,588 KB |
最終ジャッジ日時 | 2025-01-02 02:50:24 |
合計ジャッジ時間 | 2,180 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 17 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:19:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 19 | scanf("%lld", &n); | ~~~~~^~~~~~~~~~~~
ソースコード
// ※※※ 解答不能 ※※※// 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;}