結果
| 問題 | No.526 フィボナッチ数列の第N項をMで割った余りを求める |
| コンテスト | |
| ユーザー |
gu_21816943
|
| 提出日時 | 2017-06-26 01:15:00 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 419 bytes |
| 記録 | |
| コンパイル時間 | 2,273 ms |
| コンパイル使用メモリ | 82,244 KB |
| 実行使用メモリ | 43,252 KB |
| 最終ジャッジ日時 | 2026-04-20 03:23:27 |
| 合計ジャッジ時間 | 4,352 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 3 WA * 9 |
ソースコード
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String[] str=sc.nextLine().split(" ");
int[] num=new int[2];
num[0]=Integer.parseInt(str[0]);
num[1]=Integer.parseInt(str[1]);
sc.close();
int tmp1=0,tmp2=1;
int count=2;
while(count++<num[0]){
int tmp=tmp1;
tmp1=tmp2;
tmp2+=tmp;
}
System.out.println(tmp2%num[1]);
}
}
gu_21816943