22 条题解

  • -11
    @ 2022-1-8 10:22:07
    #include <iostream>
    #include <math.h>
    #include <iomanip>
    using namespace std;
    int main()
    {
        int n;
        cin >> n;
        int a,b,c;
        a = b = c = 1;
        for(int i = 3; i <= n ; ++i)
        {
        	c = a + b;
        	a = b;
        	b = c;
    	}
    	cout << c << endl;   
    }
    • -12
      @ 2022-1-8 10:23:34
      #include <stdio.h>
      #include <iostream>
      using namespace std;
      int main()
      {
          int n;
          cin >> n;
          int a,b,c;
          a = b = c = 1;
          for (int i = 3;i<= n; i++)
          {
              c = a + b;
              a = b;
              b = c;
          }
          cout << c << endl;
      }
      

      信息

      ID
      904
      时间
      1000ms
      内存
      128MiB
      难度
      4
      标签
      递交数
      761
      已通过
      346
      上传者