随笔分类 - 二分
摘要:A sequence of N positive integers (10 include include using namespace std; const int maxn=1e5+5; int sum[maxn]; int main() { int t; cin t; while(t ) {
阅读全文
摘要:时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 32768K,其他语言65536K 64bit IO Format: %lld 题目描述 给出n个整数和x,请问这n个整数中是否存在三个数a,b,c使得ax2+bx+c=0,数字可以重复使用。 输入描述: 第一行两个整数n,x 第二行n
阅读全文
摘要:Data mining huge data sets can be a painful and long lasting process if we are not aware of tiny patterns existing within those data sets. One reputab
阅读全文
摘要:Farmer John wants to set up a telephone line at his farm. Unfortunately, the phone company is uncooperative, so he needs to pay for some of the cables
阅读全文
摘要:Bessie noted that although humans have many universities they can attend, cows have none. To remedy this problem, she and her fellow cows formed a new
阅读全文
摘要:Every year the cows hold an event featuring a peculiar version of hopscotch that involves carefully jumping from rock to rock in a river. The exciteme
阅读全文
摘要:Farmer John is an astounding accounting wizard and has realized he might run out of money to run the farm. He has already calculated and recorded the
阅读全文
摘要:In a certain course, you take n tests. If you get ai out of bi questions correct on test i, your cumulative average is defined to be . Given your test
阅读全文
摘要:Demy has n jewels. Each of her jewels has some value vi and weight wi. Since her husband John got broke after recent financial crises, Demy has decide
阅读全文
摘要:Farmer John has built a new long barn, with N (2 include using namespace std; const int INF=1e9+5,maxn=1e5+5; int n,k; int a[maxn]; bool check(int x)
阅读全文
摘要:Inhabitants of the Wonderland have decided to hold a regional programming contest. The Judging Committee has volunteered and has promised to organize
阅读全文
摘要:http://bestcoder.hdu.edu.cn/contests/contest_chineseproblem.php?cid=682&pid=1003 中文题意,不再描述。 题解: 顺序给山峰出现的时间,明显地用二分来查找。然后连通块用并查集(也可以BFS,复杂度都是O(n))来维护。 1
阅读全文
摘要:Given a n × n matrix A and a positive integer k, find the sum S = A + A2 + A3 + … + Ak. Given a n × n matrix A and a positive integer k, find the sum
阅读全文