2 条题解

  • 4
    @ 2024-5-10 17:02:32

    #include using namespace std; int countWays(int n) { if (n <= 0) { return 0; } else if (n == 1) { return 1; } else if (n == 2) { return 2; } else { return countWays(n - 1) + countWays(n - 2); } } int main() { int n; while (cin >> n) { cout << countWays(n) << endl; } return 0; }

    • 3
      @ 2024-5-10 17:11:14

      应要求已关闭全部题解

      • 1

      信息

      ID
      105
      时间
      1000ms
      内存
      128MiB
      难度
      7
      标签
      (无)
      递交数
      165
      已通过
      39
      上传者