CF175C 贪心,注意有不少细节,很容易死循环TLE 贪心是显而易见的,每次枚举价值最小的物品,进行销毁操作 朴素的枚举每一件物品复杂度为\(O(\sum k_i)\),明显超时 我们注意到朴素的+1枚举中有很多情况是重复的,那就可以通过乘法来跳过 #include <bits/stdc++.h> #define int long long using namespace std; int n,ans,m,p[105]; struct obj{int k,c;}a[105]; inline…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1052 Problem Description Here is a famous story in Chinese history. "That was about 2300 years ago. General Tian Ji was a high official in the country Qi. He likes to play horse racing with the king and…
Tian Ji -- The Horse Racing Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Problem Description Here is a famous story in Chinese history. “That was about 2300 years ago. General Tian Ji was a high official in the cou…
Tian Ji -- The Horse Racing Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 11572 Accepted Submission(s): 3239 Problem Description Here is a famous story in Chinese history. "That was about 2…
Tian Ji -- The Horse Racing Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 41290 Accepted Submission(s): 12427 Problem Description Here is a famous story in Chinese history. "That was about 2300…
思路:先按从小到大排序, 然后从最快的開始比(如果i, j 是最慢的一端, flag1, flag2是最快的一端 ),田的最快的大于king的 则比較,如果等于然后推断,有三种情况: 一:大于则比較,二等于在推断田的最慢的是不是比king的最快的慢,三小于则与king的最快的比較: Tian Ji -- The Horse Racing Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Othe…