/ Randle /

记录详情

Runtime Error


  
[Hydro](https://hydro.ac)提供评测服务
# 状态 耗时 内存占用
#1 Time Exceeded ≥785ms ≥492.0 KiB
#2 Time Exceeded ≥761ms ≥456.0 KiB
#3 Time Exceeded ≥1351ms ≥504.0 KiB
#4 Runtime Error Segmentation fault 1ms 428.0 KiB
#5 Runtime Error Segmentation fault 1ms 368.0 KiB
#6 Runtime Error Segmentation fault 1ms 404.0 KiB
#7 Runtime Error Segmentation fault 1ms 380.0 KiB
#8 Runtime Error Segmentation fault 1ms 380.0 KiB
#9 Runtime Error Segmentation fault 1ms 388.0 KiB
#10 Runtime Error Segmentation fault 1ms 416.0 KiB

代码

#include <iostream>
#include <algorithm>
#include <string.h>

using namespace std;
int  dp[1000000];
int f(int x)
{
    if(dp[x] != 0)
    {
        return dp[x];
    }
    int res;
    if(x == 0)
        return 1;
    if(x < 0)
        return 0;
    if(x == 1)
        res = 1;
    else
        res = f(x-1)+f(x-2);
    return dp[x] = res;
}
int main()
{
   int x;
   cin>>x;
   while (x != 0)
   {
       cout<<f(x)<<endl;
       cin>>x;
   }
    return 0;
}

信息

递交者
类型
递交
题目
上楼梯(数据原创)
题目数据
下载
语言
C++
递交时间
2021-10-01 17:00:02
评测时间
2021-10-17 13:46:45
评测机
分数
0
总耗时
2912ms
峰值内存
504.0 KiB