<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                原題鏈接:[http://acm.hdu.edu.cn/showproblem.php?pid=2614](http://acm.hdu.edu.cn/showproblem.php?pid=2614) **一:原題內容** Problem Description Zty is a man that always full of enthusiasm. He wants to solve every kind of difficulty ACM problem in the world. And he has a habit that he does not like to solve a problem that is easy than problem he had solved. Now yifenfei give him n difficulty problems, and tell him their relative time to solve it after solving the other one. You should help zty to find a order of solving problems to solve more difficulty problem.? You may sure zty first solve the problem 0 by costing 0 minute. Zty always choose cost more or equal time’s problem to solve.? Input The input contains multiple test cases. Each test case include, first one integer n ( 2< n < 15).express the number of problem. Than n lines, each line include n integer Tij ( 0<=Tij<10), the i’s row and j’s col integer Tij express after solving the problem i, will cost Tij minute to solve the problem j. Output For each test case output the maximum number of problem zty can solved. Sample Input ~~~ 3 0 0 0 1 0 1 1 0 0 3 0 2 2 1 0 1 1 1 0 5 0 1 2 3 1 0 0 2 3 1 0 0 0 3 1 0 0 0 0 2 0 0 0 0 0 ~~~ Sample Output ~~~ 3 2 4 Hint Hint: sample one, as we know zty always solve problem 0 by costing 0 minute. So after solving problem 0, he can choose problem 1 and problem 2, because T01 >=0 and T02>=0. But if zty chooses to solve problem 1, he can not solve problem 2, because T12 < T01. So zty can choose solve the problem 2 second, than solve the problem 1. ~~~ **二:理解分析** 一個人做n道題,但是他有一個習慣,每做一題,該題必須比上一次做的題的難度大,難度大小根據做題所需的時間判斷。 **三:AC代碼** ~~~ #define _CRT_SECURE_NO_DEPRECATE #define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 1 #include<iostream> #include<string.h> #define max(a, b) (((a) > (b)) ? (a) : (b)) using namespace std; bool visit[16]; //從0到n-1標記題號是否做過 int time[16][16]; // int n; // int sum; //記錄做出題的最大數 void DFS(int, int, int); int main() { while (cin >> n) { memset(visit, 0, sizeof(visit)); sum = 0; for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) cin >> time[i][j]; DFS(0, 0, 1);//第二個參數只要不大于0就行,也就是小于等于0皆可 visit[0] = 1;//解決第一題 cout << sum << endl; } return 0; } void DFS(int cur,int lastTime,int cnt)//cur代表現在正要解決的題號(從0到n-1),也就是time數組的橫坐標;lastTime是上一次做題的時間;cnt是已經解決了多少題 { sum = max(sum, cnt);//這里要隨時更新,因為題意是找到所能做出的題目的最大值 if (sum == n)//如果能把所有題目做完,那還做什么呢?停止! return; for (int i = 1; i < n; i++)//第一題已被解決,所以從1開始 { if (!visit[i] && time[cur][i] >= lastTime) { visit[i] = 1; DFS(i, time[cur][i], cnt+1); visit[i] = 0; } } } ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看