結果

問題 No.639 An Ordinary Sequence
ユーザー tenten
提出日時 2020-09-04 18:40:08
言語 Java
(openjdk 23)
結果
AC  
実行時間 126 ms / 1,000 ms
コード長 433 bytes
コンパイル時間 4,259 ms
コンパイル使用メモリ 74,916 KB
実行使用メモリ 55,868 KB
最終ジャッジ日時 2024-11-26 10:16:35
合計ジャッジ時間 5,745 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    static HashMap<Long, Long> map = new HashMap<>();
	public static void main (String[] args) {
    	Scanner sc = new Scanner(System.in);
    	long n = sc.nextLong();
    	map.put(0L, 1L);
    	System.out.println(get(n));
    }
    
    static long get(long x) {
        if (!map.containsKey(x)) {
            map.put(x, get(x / 3) + get(x / 5));
        }
        return map.get(x);
    }
}
0