题意: 一排有着不同能力值的人比赛,规定裁判的序号只能在两人之间,而且技能值也只能在两人之间 问题: <算法竞赛入门经典-训练指南>的分析: 上代码: #include<iostream> #include<cstring> using namespace std; +; +; int a[maxn]; int BIt[maxa]; int c[maxn]; int d[maxn]; int n; long long ans; int lowbit(int x) { r…
第一次写树状数组,感觉那个lowbit位运算用的相当厉害. 因为-x相当于把x的二进制位取反然后整体再加上1,所以最右边的一个1以及末尾的0,取反加一以后不变. 比如1000取反是0111加一得到1000,这样与运算以后不变 最右边的1左边部分取反,加一不会影响左半部分,所以与运算以后全部为0 对于这道题来说貌似不是很容易能联想到树状数组 注意题中说了每个人的技能值互不相同. 从左往右扫描每个a[i],另x[a[i]] = 1,然后统计x[1]...x[a[i]-1]的和就是第i个人左边技能值比…
题目描述: N <tex2html_verbatim_mark>(3N20000) <tex2html_verbatim_mark>ping pong players live along a west-east street(consider the street as a line segment). Each player has a unique skill rank. To improve their skill rank, they often compete with…
Ping pong Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 2302   Accepted: 879 Description N(3<=N<=20000) ping pong players live along a west-east street(consider the street as a line segment). Each player has a unique skill rank. To im…
书上具体所有题目:http://pan.baidu.com/s/1hssH0KO 都是<算法竞赛入门经典(第二版)>的题目,标题上没写(第二版) 题目:算法竞赛入门经典 3-7/UVa1368:DNA Consensus String 代码: //UVa1368 - DNA Consensus String #include<iostream> using namespace std; #define MAX_M 52 #define MAX_N 1005 char DNA[MAX…
http://www.cnblogs.com/sxiszero/p/3618737.html 下面给出的题目共计560道,去掉重复的也有近500题,作为ACMer Training Step1,用1年到1年半年时间完成.打牢基础,厚积薄发. 一.UVaOJ http://uva.onlinejudge.org 西班牙Valladolid大学的程序在线评测系统,是历史最悠久.最著名的OJ. 二.<算法竞赛入门经典> 刘汝佳  (UVaOJ  351道题) 以下部分内容摘自:http://sdkd…
下面给出的题目共计560道,去掉重复的也有近500题,作为ACMer Training Step1,用1年到1年半年时间完成.打牢基础,厚积薄发. 一.UVaOJ http://uva.onlinejudge.org 西班牙Valladolid大学的程序在线评测系统,是历史最悠久.最著名的OJ. 二.<算法竞赛入门经典> 刘汝佳  (UVaOJ  351道题) 以下部分内容摘自:http://sdkdacm.5d6d.com/thread-6-1-1.html “AOAPC I”是刘汝佳(大名…
书上具体所有题目:http://pan.baidu.com/s/1hssH0KO 题目:算法竞赛入门经典 3-4/UVa11809:Floating-Point Numbers 代码: //UVa11809 - Floating-Point Numbers #include<iostream> #include<sstream> #include<cmath> long long E[12][33], e; double M[12][33], m, re; char s…
书上具体所有题目:http://pan.baidu.com/s/1hssH0KO 题目:算法竞赛入门经典 3-10/UVa1587:Box 代码: //UVa1587 - Box #include<iostream> unsigned rect[6];//每个面各有一个一样的对应面,故12个边只要定义6个,其中每偶奇两个代表一个长方形的两个边长 bool flag, times[3];//每个面出现的次数(出现第二次时为true) unsigned tmpx, tmpy, now; int m…
书上具体所有题目:http://pan.baidu.com/s/1hssH0KO 题目:算法竞赛入门经典 3-4/UVa455:Periodic Strings 代码: //UVa455 #include<iostream> int main() { char str[82]; int num; std::cin >> num; while (num--) { std::cin>>str; char *ps = str; while (*++ps != '\0') {…