摘要:
#define DeBUG#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std ;#define zero {0}#define INF 2000000000#define EPS 1e-6typedef long long LL;const double PI = acos(-1.0);... 阅读全文
摘要:
Pick-up sticksTime Limit: 4000/2000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1771Accepted Submission(s): 672Problem DescriptionStan has n sticks of various length. He throws them one at a time on the floor in a random way. After finishing throwing, Stan tries to 阅读全文
摘要:
#define DeBUG#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std ;#define zero {0}#define INF 2000000000#define EPS 1e-6typedef long long LL;const double PI = acos(-1.0);inline int sgn(double x){return fabs 阅读全文
摘要:
#define DeBUG#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std ;#define zero {0}#define INF 200000000#define EPS 1e-6#define MM 1typedef long long LL;inline int sgn(dou... 阅读全文
摘要:
// POJ 2187 Beauty Contest -- Andrew凸包算法 + 点对距离最长(旋转卡壳)// 大意:给你一堆点,让你求出相隔最远的两点距离并输出// 要求:最后结果不需要开平方 应为距离的平方///*test data51 32 14 15 33 5 == 17*/#include #include #include using namespace std;const double Pzero = 0.000001;const int MAXP = 50005;struct Point{ double x, y;//点对应坐标 Point() {} ... 阅读全文
摘要:
int b[MAXM]=zero;//根据需要改charint a[MAXN]=zero;int next[MAXM];void GetNext(int len)//得到b的next{ int i,j; for(i=1,j=0;i<=len;) { if(j==0||b[i-1]==b[j-1]) { next[i]=j; j++; i++; } else { j=next[j]; } }}int kmp(int lena,int lenb){ int i,j; for(i=0,j=0;i<lena;) { if(j==0||a[i]==b[j]) { if(a[i]!=b[j]. 阅读全文
摘要:
在性能优化方面永远注意80-20原则,即20%的程序消耗了80%的运行时间,因而我们要改进效率,最主要是考虑改进那20%的代码。不要优化程序中开销不大的那80%,这是劳而无功的。第一招:以空间换时间 计算机程序中最大的矛盾是空间和时间的矛盾,那么,从这个角度出发逆向思维来考虑程序的效率问题,我们就有了解决问题的第1招--以空间换时间。比如说字符串的赋值:方法A:通常的办法#define LEN 32char string1 [LEN];memset (string1,0,LEN);strcpy (string1,"This is a example!!");方法B:cons 阅读全文
摘要:
#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std ;#define zero {0}#define INF 2000000000#define eps 1e-6typedef long long LL;struct Point3{ double x, y, z; Point3() {} Point3(double x, double y,... 阅读全文
摘要:
#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std ;#define zero {0}#define INF 2000000000#define eps 1e-6typedef long long LL;int Max=0;char a[1000];int n;char it[100];int f(string s){ //cout<<s< 阅读全文
摘要:
#include #include using namespace std;int main(){ios::sync_with_stdio(false); cout>a; cout>a; printf("%d",a); scanf("%d",&a); cout<<a; return 0;}取消同步可以加速cin和cout但是使用要谨慎 阅读全文