50分

P1255 数楼梯

_Glassy_Sky_ @ 2023-01-03 10:17:25

#include<bits/stdc++.h>
using namespace std;
int a[5005];
int main()
{
    int n;
    cin >> n;
    a[0] = a[1] = 1;
    for(int i = 2; i <= n; i ++)
        a[i] = a[i - 1] + a[i - 2];
    cout << a[n];
    return 0;
}

小学奥数的方法


by Hongzixuan0922 @ 2023-01-03 10:18:32

要用高精哦


by InversionShadow @ 2023-01-03 10:19:20

@FZwangmuem 似乎需要高精度


by Hongzixuan0922 @ 2023-01-03 10:22:01

但是开long long也可以的60分,满分得用高精


by Hongzixuan0922 @ 2023-01-03 10:32:39

第5000项是6276302800488957086035253108349684055478528702736457439025824448927937256811663264475883711527806250329984690249846819800648580083040107584710332687596562185073640422286799239932615797105974710857095487342820351307477141875012176874307156016229965832589137779724973854362777629878229505500260477136108363709090010421536915488632339240756987974122598603591920306874926755600361865354330444681915154695741851960071089944015319300128574107662757054790648152751366475529121877212785489665101733755898580317984402963873738187000120737824193162011399200547424034440836239726275765901190914513013217132050988064832024783370583789324109052449717186857327239783000020791777804503930439875068662687670678802914269784817022567088069496231111407908953313902398529655056082228598715882365779469902465675715699187225655878240668599547496218159297881601061923195562143932693324644219266564617042934227893371179832389642895285401263875342640468017378925921483580111278055044254198382265567395946431803304304326865077742925818757370691726168228648841319231470626


by Hongzixuan0922 @ 2023-01-03 10:33:13

必须高精


by _Glassy_Sky_ @ 2023-01-03 10:33:28

@Hongzixuan0922

艹,我改一下


by SEN7 @ 2023-01-03 10:33:51

@FZwangmuem 四十几好像就爆了


by InversionShadow @ 2023-01-03 10:34:07

@FZwangmuem 你在循坏中输出 a_i 看一下。


by _Glassy_Sky_ @ 2023-01-03 10:36:02

@hhhhhhhh314

@yuandingquan1101

好的,我用高精写一下


by Hongzixuan0922 @ 2023-01-03 10:36:40

后面爆了就变负数了


| 下一页