結果
問題 |
No.639 An Ordinary Sequence
|
ユーザー |
|
提出日時 | 2018-03-24 09:21:06 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 67 ms / 1,000 ms |
コード長 | 351 bytes |
コンパイル時間 | 224 ms |
コンパイル使用メモリ | 29,528 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2025-01-02 02:24:32 |
合計ジャッジ時間 | 1,280 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 17 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:13:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 13 | scanf("%lld",&N); | ~~~~~^~~~~~~~~~~
ソースコード
#include <stdio.h> #define CACHE_SIZE 10000 long long int dp[CACHE_SIZE]; long long int calc (long long int N){ return (N<CACHE_SIZE)? dp[N]: calc(N/3)+calc(N/5); } int main(void){ dp[0]=1; for(long long int i = 1; i < CACHE_SIZE; i++) dp[i] = dp[i/3]+dp[i/5]; long long int N; scanf("%lld",&N); printf("%lld\n", calc(N)); }