結果
| 問題 |
No.639 An Ordinary Sequence
|
| コンテスト | |
| ユーザー |
bal4u
|
| 提出日時 | 2019-07-19 05:27:04 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 10 ms / 1,000 ms |
| コード長 | 345 bytes |
| コンパイル時間 | 275 ms |
| コンパイル使用メモリ | 24,960 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2025-01-02 02:43:00 |
| 合計ジャッジ時間 | 1,109 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 17 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:17:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
17 | scanf("%lld", &N);
| ^~~~~~~~~~~~~~~~~
ソースコード
// yukicoder: No.639 An Ordinary Sequence
// 2019.7.19 bal4u
#include <stdio.h>
#define MAX 1000000
unsigned memo[MAX+5] = {1};
unsigned dp(long long a) {
if (a > MAX) return dp(a/3) + dp(a/5);
if (!memo[a]) memo[a] = dp(a/3) + dp(a/5);
return memo[a];
}
int main()
{
long long N;
scanf("%lld", &N);
printf("%u\n", dp(N));
return 0;
}
bal4u