結果
問題 | No.639 An Ordinary Sequence |
ユーザー |
|
提出日時 | 2018-01-26 22:29:00 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 473 bytes |
コンパイル時間 | 690 ms |
コンパイル使用メモリ | 112,252 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-12 23:39:46 |
合計ジャッジ時間 | 1,524 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 17 |
ソースコード
import std.stdio, std.array, std.string, std.conv, std.algorithm;import std.typecons, std.range, std.random, std.math, std.container;import std.numeric, std.bigint, core.bitop, std.bitmanip;const long MOD = 10^^9 + 7;void main() {auto N = readln.chomp.to!long;long[long] mem;long dfs(long n) {if (n in mem) return mem[n];if (n == 0) return 1;mem[n] = dfs(n/3) + dfs(n/5);return mem[n];}dfs(N).writeln;}