/ Randle /

记录详情

Runtime Error

/in/Main.java:3: warning: IREM is internal proprietary API and may be removed in a future release
import com.sun.org.apache.bcel.internal.generic.IREM;
                                               ^
1 warning
# 状态 耗时 内存占用
#1 Accepted 86ms 12.117 MiB
#2 Accepted 85ms 10.527 MiB
#3 Accepted 87ms 12.836 MiB
#4 Runtime Error 95ms 16.258 MiB
#5 Runtime Error 94ms 17.508 MiB
#6 Runtime Error 93ms 18.609 MiB
#7 Runtime Error 95ms 17.766 MiB
#8 Runtime Error 97ms 18.188 MiB
#9 Runtime Error 98ms 18.605 MiB
#10 Runtime Error 99ms 18.777 MiB

代码

import java.util.Scanner;

import com.sun.org.apache.bcel.internal.generic.IREM;

public class Main {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		if (n==1) {
			System.out.println(1);
		}else if (n==2) {
			System.out.println(2);
		}else {
			long []array = new long[n+1];
			array[1]=1;
			array[2]=2;
			for (int i = 3; i <= n; i++) {
				array[i]=(array[i-1]+array[i-2])%1000000007;
			}
System.out.println(array[n]);
		}
	}
}

信息

递交者
类型
递交
题目
上楼梯(数据原创)
题目数据
下载
语言
Java
递交时间
2019-10-28 09:25:43
评测时间
2019-10-28 09:25:43
评测机
分数
30
总耗时
935ms
峰值内存
18.777 MiB