結果
| 問題 | No.639 An Ordinary Sequence |
| コンテスト | |
| ユーザー |
htensai
|
| 提出日時 | 2019-11-14 08:46:00 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
AC
|
| 実行時間 | 57 ms / 1,000 ms |
| コード長 | 481 bytes |
| 記録 | |
| コンパイル時間 | 2,465 ms |
| コンパイル使用メモリ | 82,756 KB |
| 実行使用メモリ | 41,672 KB |
| 最終ジャッジ日時 | 2026-06-05 20:06:29 |
| 合計ジャッジ時間 | 4,436 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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