題目描述 源代碼 #include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int f[9];
int b[9];
int a[9]={1,2,3,4,5,6,7,8,9};
int judge[8];
int main()
{for (int i = 0; i < 9; ++i) {cin>>f[i];}
Problem Description 假設你正在爬樓梯。需要 n 階你才能到達樓頂。 每次你可以爬 1 或 2 個臺階。你有多少種不同的方法可以爬到樓頂呢? 注意:給定 n 是一個正整數。 Example AC Code class Solution {
public:int climbStairs(int n) {if(n==1) retur
Idea 使用C++ STL中的優先隊列 因為創建的優先隊列默認建立的是大頂堆。 所以我們最后存放的答案數組還需要進行一次反轉。 AC Code class Solution {
public:vector<int> kWeakestRows(vector<vector<int>>& mat, int k) {priority_queue<p