結果
| 問題 |
No.44 DPなすごろく
|
| ユーザー |
neko_the_shadow
|
| 提出日時 | 2019-02-24 16:58:23 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 147 ms / 5,000 ms |
| コード長 | 433 bytes |
| コンパイル時間 | 2,630 ms |
| コンパイル使用メモリ | 74,572 KB |
| 実行使用メモリ | 41,436 KB |
| 最終ジャッジ日時 | 2024-12-23 06:33:16 |
| 合計ジャッジ時間 | 6,388 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 |
ソースコード
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner stdin = new Scanner(System.in);
int n = stdin.nextInt();
long[] dp = new long[n + 1];
dp[0] = 1;
for (int i = 0; i < n; i++) {
if (i + 1 <= n) dp[i + 1] += dp[i];
if (i + 2 <= n) dp[i + 2] += dp[i];
}
System.out.println(dp[n]);
}
}
neko_the_shadow