/ Randle /

记录详情

Time Exceeded

/in/foo.cc: In function 'int main()':
/in/foo.cc:15:15: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'll* {aka long long int*}' [-Wformat=]
  scanf("%d",&n);
               ^
# 状态 耗时 内存占用
#1 Accepted 4ms 256.0 KiB
#2 Accepted 4ms 256.0 KiB
#3 Accepted 4ms 256.0 KiB
#4 Accepted 955ms 384.0 KiB
#5 Time Exceeded ≥1000ms ≥256.0 KiB
#6 Time Exceeded ≥1003ms ≥348.0 KiB
#7 Time Exceeded ≥1004ms ≥352.0 KiB
#8 Time Exceeded ≥1005ms ≥376.0 KiB
#9 Time Exceeded ≥1003ms ≥348.0 KiB
#10 Time Exceeded ≥1004ms ≥356.0 KiB

代码

#include<iostream>
#include<cstdio>
using namespace std;
typedef long long ll;
const int md=1e9+7;
ll f[4];
ll n;
void solve(){
	f[1]=1,f[2]=1;
	for(int i=3; i<=n+1; i++)
	  f[i%3] = (f[(i-1)%3] % md + f[(i-2)%3] %md) %md;
	printf("%lld",f[(n+1)%3]);
}
int main(){
	scanf("%d",&n);
	solve();
	return 0;
}

信息

递交者
类型
递交
题目
上楼梯(数据原创)
题目数据
下载
语言
C++
递交时间
2018-01-03 14:43:10
评测时间
2018-01-03 14:43:11
评测机
分数
40
总耗时
≥6991ms
峰值内存
≥384.0 KiB