結果
| 問題 |
No.639 An Ordinary Sequence
|
| コンテスト | |
| ユーザー |
htensai
|
| 提出日時 | 2019-11-14 08:46:00 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 132 ms / 1,000 ms |
| コード長 | 481 bytes |
| コンパイル時間 | 2,499 ms |
| コンパイル使用メモリ | 77,872 KB |
| 実行使用メモリ | 54,508 KB |
| 最終ジャッジ日時 | 2025-01-02 02:48:55 |
| 合計ジャッジ時間 | 5,942 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 17 |
ソースコード
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();
System.out.println(getValue(n));
}
static long getValue(long x) {
if (x == 0) {
return 1;
}
if (map.containsKey(x)) {
return map.get(x);
}
long ans = getValue(x / 3) + getValue(x / 5);
map.put(x, ans);
return ans;
}
}
htensai