2013年7月1日

NYoj536 矩阵链乘

摘要: 经典问题没啥说的#include#include#define max 100+1#define min(a,b) (a<b?a:b)typedef long long LL;LL dp[max][max];int p[max];int main(){ int n; while(~scanf("%d... 阅读全文

posted @ 2013-07-01 14:50 Stomach_ache 阅读(115) 评论(0) 推荐(0) 编辑

2013年6月29日

欧拉路与欧拉回路

摘要: 对无向图:定义:给定无孤立结点图G,若存在一条路,经过图中每条边一次且仅仅一次,该条路称欧拉路,若存在一条回路,经过图中每边一次且仅仅一次,该回路称为欧拉回路。具有欧拉回路的图称为欧拉图,不是柏拉图。定理:无向图G具有一条欧拉路,当且仅当G是连通的,且有0个或者是两个奇数度得结点。推论:无向图G具有... 阅读全文

posted @ 2013-06-29 17:22 Stomach_ache 阅读(257) 评论(0) 推荐(0) 编辑

HDU1059

摘要: /** 母函数+优化*/#include#include#define max 20000int c1[max],c2[max];int a[7];int main(){ for(int i=1;;i++){ int sum=0; for(int j=1;j<7;j++){ scanf("... 阅读全文

posted @ 2013-06-29 17:00 Stomach_ache 阅读(98) 评论(0) 推荐(0) 编辑

HDU2056

摘要: /** 指数型母函数*/#include#define mod 100typedef long long LL;//杭电需用int64int powerMod(int a,LL b){ LL ans=1; while(b){ if(b%2){ ans=(ans*a)%mod; } a=(... 阅读全文

posted @ 2013-06-29 16:58 Stomach_ache 阅读(97) 评论(0) 推荐(0) 编辑

HDU1709

摘要: /** 好奇怪的母函数*/#include#include#include#includeusing namespace std;#define max 100*100+10int c1[max],c2[max],a[max];int main(){ int n; while(~scanf("%d... 阅读全文

posted @ 2013-06-29 16:52 Stomach_ache 阅读(105) 评论(0) 推荐(0) 编辑

ubuntu忘记root密码

摘要: 解决办法:选择GRUB第2个选项(恢复模式)按e进入编辑模式将ro recovery nomodeset修改成rw single init=/bin/bash然后再按F10进入单用户模式,进入命令行的时候passwd修改密码最后按神键ctrl+alt+del重启即可。 阅读全文

posted @ 2013-06-29 14:14 Stomach_ache 阅读(138) 评论(0) 推荐(0) 编辑

2013年6月26日

告别水题

摘要: 突然发现大一美好的时光马上就要结束了,自己也将成为学长。。。此刻心情无比悲痛,更重要的是似乎期末考试有挂科的风险,可能是花了大量时间在算法学习上,导致成为了一枚学渣,不过还有十天呢哈哈,要努力复习了,同时对于即将步入大二的我来说,也该是和水题说拜拜的时候了。。。暑假集训继续加油!!!!!!!!!!... 阅读全文

posted @ 2013-06-26 16:10 Stomach_ache 阅读(129) 评论(0) 推荐(0) 编辑

POJ2823 单调队列

摘要: #include#define max 1000000+5int a[max],q1[max]/*单调递增*/,q2[max]/*单调递减*/,ans1[max],ans2[max];int n,k,h1,t1,h2,t2;void q1_in(int i){ //入队 while(h1=a[i]... 阅读全文

posted @ 2013-06-26 16:03 Stomach_ache 阅读(98) 评论(0) 推荐(0) 编辑

HDU2699 扩展欧几里德

摘要: //赤裸裸,不解释#includetypedef long long LL; //hdu需用int64void gcd(int a,int b,LL& d,LL& x,LL& y){ if(!b){ d=a;x=1;y=0; } else{ gcd(b,a%b,d,y,x); y-=x*(a/... 阅读全文

posted @ 2013-06-26 13:01 Stomach_ache 阅读(120) 评论(0) 推荐(0) 编辑

2013年6月25日

HDU4355 三分查找

摘要: /** 三分查找*/#include#include#define eps 1e-6//typedef __int64 LL;int n;double x[50005], w[50005];double func(double y){ double res=0; for(int i=0;ieps)... 阅读全文

posted @ 2013-06-25 17:32 Stomach_ache 阅读(115) 评论(0) 推荐(0) 编辑

导航