04 2014 档案

摘要:http://codeforces.com/contest/424/problem/C 1 #include 2 #include 3 #include 4 #include 5 #define maxn 1000001 6 using namespace std; 7 8 int f[m... 阅读全文
posted @ 2014-04-28 22:14 null1019 阅读(90) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1596 1 #include 2 #include 3 #include 4 #define maxn 1001 5 using namespace std; 6 7 double g[maxn][maxn... 阅读全文
posted @ 2014-04-27 20:57 null1019 阅读(112) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1595这道题我用spfa在枚举删除边的时候求最短路超时,改用dijkstra就过了。 1 #include 2 #include 3 #include 4 #include 5 #define m... 阅读全文
posted @ 2014-04-27 20:11 null1019 阅读(230) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1548 1 #include 2 #include 3 #include 4 #include 5 #include 6 #define maxn 300 7 using namespace std; 8... 阅读全文
posted @ 2014-04-26 18:27 null1019 阅读(112) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1546 1 #include 2 #include 3 #include 4 #include 5 #include 6 #define maxn 1001 7 using namespace std; ... 阅读全文
posted @ 2014-04-26 16:32 null1019 阅读(114) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1535这道题两遍spfa,第一遍sfpa之后,重新建图,所有的边逆向建边,再一次spfa就可以了。 1 #include 2 #include 3 #include 4 #include 5 #includ... 阅读全文
posted @ 2014-04-25 21:23 null1019 阅读(149) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1142这道题是spfa求最短路,然后dfs()求路径数。 1 #include 2 #include 3 #include 4 #include 5 #define maxn 1001 6 us... 阅读全文
posted @ 2014-04-24 20:32 null1019 阅读(132) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1245 1 #include 2 #include 3 #include 4 #include 5 #include 6 #define maxn 500 7 using namespace... 阅读全文
posted @ 2014-04-23 15:41 null1019 阅读(99) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=3790 1 #include 2 #include 3 #include 4 #define maxn 1001 5 using namespace std; 6 const int inf=1dis[x]+... 阅读全文
posted @ 2014-04-23 14:49 null1019 阅读(124) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1317 1 #include 2 #include 3 #include 4 #include 5 #define maxn 1001 6 using namespace std; 7 const int ... 阅读全文
posted @ 2014-04-23 14:48 null1019 阅读(192) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1874 1 #include 2 #include 3 #include 4 #define maxn 500 5 using namespace std; 6 const int inf=1<<28; 7 ... 阅读全文
posted @ 2014-04-22 19:05 null1019 阅读(131) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2544 1 #include 2 #include 3 #include 4 #define maxn 500 5 using namespace std; 6 const int inf=1<<28; 7 ... 阅读全文
posted @ 2014-04-21 22:11 null1019 阅读(166) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2066这道题用floyd做的时候要稍微优化,不优化就会超时。 1 #include 2 #include 3 #include 4 #include 5 #define maxn 1001 6 using ... 阅读全文
posted @ 2014-04-21 21:58 null1019 阅读(140) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1116欧拉通路和欧拉回路 1 #include 2 #include 3 #include 4 #define maxn 1000 5 using namespace std; 6 7 int f[maxn... 阅读全文
posted @ 2014-04-21 21:18 null1019 阅读(163) 评论(0) 推荐(0)
摘要:http://codeforces.com/contest/336/problem/B 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 int main() 8 { 9 int m,r;1... 阅读全文
posted @ 2014-04-21 11:08 null1019 阅读(195) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=3339这道题就是dijkstra+01背包,先求一遍最短路,再用01背包求。 1 #include 2 #include 3 #include 4 #define maxn 100000 5 using na... 阅读全文
posted @ 2014-04-20 15:57 null1019 阅读(149) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1869 1 #include 2 #include 3 #include 4 #define maxn 500 5 using namespace std; 6 const int inf=1g[i][k]+... 阅读全文
posted @ 2014-04-20 14:24 null1019 阅读(146) 评论(0) 推荐(0)
摘要:http://codeforces.com/contest/336/problem/A 1 #include 2 #include 3 #include 4 using namespace std; 5 6 int main() 7 { 8 int x,y; 9 scanf(... 阅读全文
posted @ 2014-04-20 13:56 null1019 阅读(138) 评论(0) 推荐(0)
摘要:http://codeforces.com/contest/334/problem/C 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 long long n; 8 int main() 9 {1... 阅读全文
posted @ 2014-04-20 13:17 null1019 阅读(121) 评论(0) 推荐(0)
摘要:http://codeforces.com/contest/334/problem/B 1 #include 2 #include 3 #include 4 using namespace std; 5 6 const int maxn=2e6; 7 struct node 8 { 9 ... 阅读全文
posted @ 2014-04-20 12:28 null1019 阅读(192) 评论(0) 推荐(0)
摘要:http://codeforces.com/contest/332/problem/B 1 #include 2 #include 3 #include 4 #define maxn 200010 5 using namespace std; 6 int a[maxn]; 7 long lon... 阅读全文
posted @ 2014-04-19 14:56 null1019 阅读(245) 评论(1) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1385 1 #include 2 #include 3 #include 4 #define maxn 1001 5 using namespace std; 6 const int inf=9999999;... 阅读全文
posted @ 2014-04-18 21:37 null1019 阅读(137) 评论(0) 推荐(0)
摘要:http://codeforces.com/contest/332/problem/A 1 #include 2 #include 3 #include 4 #include 5 #define maxn 3000 6 using namespace std; 7 8 char str[m... 阅读全文
posted @ 2014-04-18 20:31 null1019 阅读(121) 评论(0) 推荐(0)
摘要:http://codeforces.com/contest/330/problem/C这道题分三种情况。有一行全是E,有一列全是E,还有一种为无解的情况。 1 #include 2 #include 3 #include 4 #define maxn 200 5 using namespace... 阅读全文
posted @ 2014-04-18 19:54 null1019 阅读(100) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1224 1 #include 2 #include 3 #include 4 #include 5 #define maxn 5600 6 using namespace std; 7 con... 阅读全文
posted @ 2014-04-18 18:55 null1019 阅读(138) 评论(0) 推荐(0)
摘要:http://codeforces.com/contest/330/problem/B这道题可以围着一个可以与任何一个城市建路的城市建设。 1 #include 2 #include 3 #include 4 using namespace std; 5 6 bool g[1001][100... 阅读全文
posted @ 2014-04-17 19:42 null1019 阅读(179) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=3371这道题要注意重边。 1 #include 2 #include 3 #include 4 #define maxn 1000 5 using namespace std; 6 const int inf... 阅读全文
posted @ 2014-04-17 18:31 null1019 阅读(128) 评论(0) 推荐(0)
摘要:http://codeforces.com/contest/327/problem/B这道题素数打表就行。 1 #include 2 #include 3 #include 4 #include 5 #define maxn 2000100 6 using namespace std; 7 ... 阅读全文
posted @ 2014-04-17 16:45 null1019 阅读(143) 评论(0) 推荐(0)
摘要:http://codeforces.com/contest/320/problem/B这道题看了很长时间没看懂, 就是个dfs; 1 #include 2 #include 3 #define maxn 2000 4 using namespace std; 5 6 int a[maxn],b... 阅读全文
posted @ 2014-04-16 16:30 null1019 阅读(149) 评论(0) 推荐(0)
摘要:http://codeforces.com/contest/320/problem/A 1 #include 2 #include 3 using namespace std; 4 5 char str[100]; 6 7 int main() 8 { 9 scanf("%s",st... 阅读全文
posted @ 2014-04-16 15:29 null1019 阅读(111) 评论(0) 推荐(0)
摘要:http://codeforces.com/contest/318/problem/C 1 #include 2 #include 3 #include 4 using namespace std; 5 long long j; 6 long long x,y,m; 7 int main() ... 阅读全文
posted @ 2014-04-15 21:48 null1019 阅读(146) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1879这道题可以把已修建的道路的费用置为0,然后用prim和kruskal都可以求出。 1 #include 2 #include 3 #include 4 #define maxn 20000 5 usin... 阅读全文
posted @ 2014-04-15 20:32 null1019 阅读(169) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1875 1 #include 2 #include 3 #include 4 #include 5 #define maxn 1001 6 using namespace std; 7 const int ... 阅读全文
posted @ 2014-04-15 19:31 null1019 阅读(166) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1863 1 #include 2 #include 3 #include 4 #include 5 #define maxn 200 6 using namespace std; 7 const int i... 阅读全文
posted @ 2014-04-14 22:13 null1019 阅读(196) 评论(0) 推荐(0)
摘要:http://codeforces.com/contest/318/problem/B 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 char str[2000000]; 8 9 int ma... 阅读全文
posted @ 2014-04-14 21:57 null1019 阅读(131) 评论(0) 推荐(0)
摘要:http://codeforces.com/contest/315/problem/B 1 #include 2 #include 3 #include 4 #include 5 #define maxn 200000 6 using namespace std; 7 8 int a[ma... 阅读全文
posted @ 2014-04-14 20:49 null1019 阅读(110) 评论(0) 推荐(0)
摘要:http://codeforces.com/contest/313/problem/C 1 #include 2 #include 3 #include 4 using namespace std; 5 long long a[3000000]; 6 7 int main() 8 { 9 ... 阅读全文
posted @ 2014-04-14 20:01 null1019 阅读(137) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1301 1 #include 2 #include 3 #include 4 #define maxn 500 5 using namespace std; 6 const int inf=1g[x][y])... 阅读全文
posted @ 2014-04-14 10:32 null1019 阅读(97) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1233 1 #include 2 #include 3 #include 4 #define maxn 500 5 using namespace std; 6 const int inf=1g[x][y])... 阅读全文
posted @ 2014-04-14 10:11 null1019 阅读(119) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1198 1 #include 2 #include 3 #include 4 #define maxn 4000 5 using namespace std; 6 7 int b[11][4]={{1,0,... 阅读全文
posted @ 2014-04-13 21:43 null1019 阅读(122) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1162 1 #include 2 #include 3 #include 4 #include 5 #include 6 #define maxn 200 7 using namespace std; 8... 阅读全文
posted @ 2014-04-13 20:26 null1019 阅读(117) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1102 1 #include 2 #include 3 #include 4 #define maxn 1001 5 using namespace std; 6 const int inf=1<<30; 7... 阅读全文
posted @ 2014-04-13 19:35 null1019 阅读(130) 评论(0) 推荐(0)
摘要:类似于素数打表。 1 #include 2 #include 3 #include 4 #define maxn 1000100 5 using namespace std; 6 7 int f[maxn]; 8 9 void inti()10 {11 int num=0;12 ... 阅读全文
posted @ 2014-04-13 18:15 null1019 阅读(170) 评论(0) 推荐(0)
摘要:这道题的知识点第一次听说 ,就是应用斯特林数。题目的意思是给你房间数N,和最多能破门的个数,让你求能全部把房间打开的概率!a[i][j]=a[i-1][j-1]+(i-1)*a[i-1][j]; 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 long long f[30],a[30][30]; 8 9 void inti()10 {11 f[1]=1;12 f[0]=1;13 for(int i=2; i<=20; i++)14 {15 f... 阅读全文
posted @ 2014-04-13 10:30 null1019 阅读(246) 评论(0) 推荐(0)
摘要:这道题是寻找规律。别的方法一般都是超时。 1 #include 2 #include 3 #include 4 using namespace std; 5 6 int f[300]; 7 8 int main() 9 {10 int a,b,n,i;11 while(scanf("%d%d%d",&a,&b,&n)!=EOF)12 {13 if(a==0&&b==0&&n==0) break;14 if(n>=3)15 {16 f[1]=1;17 f[2]=1;1... 阅读全文
posted @ 2014-04-12 22:41 null1019 阅读(114) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 #include 4 using namespace std; 5 6 int main() 7 { 8 int t,n; 9 scanf("%d",&t);10 while(t--)11 {12 scanf("%d",&n);13 double sum=0;14 for(int i=1; i<=n; i++)15 {16 sum+=log10((double)i);17 }18 pri... 阅读全文
posted @ 2014-04-12 21:09 null1019 阅读(116) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 #include 4 using namespace std; 5 6 int a[20000]; 7 8 bool f(int k,int m) 9 {10 int s=0,e=k-1;11 for(int i=2*k; i>k; i--)12 {13 int k1=(m-1)%i;14 if(k1>=s&&k1<=e)15 {16 return false;17 }18 s=((s-m)%i+i)%i;1... 阅读全文
posted @ 2014-04-12 19:51 null1019 阅读(219) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 int f[30],n; 8 9 int main()10 {11 f[0]=0;12 f[1]=1;13 for(int i=2; i<21; i++)14 {15 f[i]=f[i-1]+f[i-2];16 }17 while(scanf("%d",&n)!=EOF)18 {19 if(n<=20)20 {21 ... 阅读全文
posted @ 2014-04-12 19:19 null1019 阅读(153) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 #include 4 #define maxn 500000 5 using namespace std; 6 int f[maxn]; 7 void inti() 8 { 9 for(int i=1; i<=maxn; i++)10 {11 f[i]=1;12 }13 for(int i=2; i<=250000; i++)14 {15 for(int j=i+i; j<=maxn ; j+=i)16 {17 f[j]+=i;... 阅读全文
posted @ 2014-04-08 21:25 null1019 阅读(111) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 #include 4 using namespace std; 5 6 int main() 7 { 8 int t,a,b,c,d; 9 scanf("%d",&t);10 while(t--)11 {12 scanf("%d/%d %d/%d",&a,&b,&c,&d);13 int m=__gcd(a,b);14 a/=m;b/=m;15 int x=__gcd(c,d);16 c/=x;d/=x;17 ... 阅读全文
posted @ 2014-04-08 20:59 null1019 阅读(122) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 #include 4 using namespace std; 5 bool vis[32769]; 6 int main() 7 { 8 int t,n; 9 scanf("%d",&t);10 while(t--)11 {12 scanf("%d",&n);13 int ans=0;14 memset(vis,false,sizeof(vis));15 for(int i=2; i<=n; i++)16 {17 ... 阅读全文
posted @ 2014-04-08 20:34 null1019 阅读(144) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 #include 4 #include 5 #define maxn 1000 6 using namespace std; 7 char str[maxn]; 8 9 int change(char *s)10 {11 int k=strlen(s);12 int pos;13 int sum=0;14 for(int i=0; i=0; i--)31 {32 sum+=(s[i]-'0')*pow(m,j);33 j++;34 }35 retu... 阅读全文
posted @ 2014-04-05 22:10 null1019 阅读(113) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1081 1 #include 2 #include 3 #include 4 #define maxn 300 5 using namespace std; 6 const int inf=0x7fffffff; 7 8 int dp[maxn][maxn]; 9 int a[maxn][maxn];10 11 int main()12 {13 int n;14 while(scanf("%d",&n)!=EOF)15 {16 for(int i=1; i<=n... 阅读全文
posted @ 2014-04-04 20:50 null1019 阅读(100) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1559 1 #include 2 #include 3 #include 4 #define maxn 1001 5 using namespace std; 6 7 int b[maxn][maxn]; 8 int a[maxn][maxn]; 9 int dp[maxn];10 int n,m,x,y;11 12 int main()13 {14 int t;15 scanf("%d",&t);16 while(t--)17 {18 scanf("%... 阅读全文
posted @ 2014-04-04 20:37 null1019 阅读(129) 评论(0) 推荐(0)
摘要:这道题看着别人的代码写的。 1 #include 2 #include 3 #define m 1000000009 4 using namespace std; 5 6 bool prime[10][10][10]; 7 int dp[10001][10][10]; 8 int temp=0; 9 10 11 void getprime()12 {13 memset(dp,0,sizeodp(dp));14 bool p[1000];15 memset(p,false,sizeof(p));16 for(int i=2; i0&&(prime[x1][x... 阅读全文
posted @ 2014-04-04 19:34 null1019 阅读(129) 评论(0) 推荐(0)
摘要:http://poj.org/problem?id=3792 1 #include 2 #include 3 #include 4 #include 5 #define maxn 2000 6 using namespace std; 7 struct node 8 { 9 int x,y,z;10 }p[maxn];11 int main()12 {13 int t,n;14 scanf("%d",&t);15 for(int i=1; i<=t; i++)16 {17 int ans=0;18 scanf("... 阅读全文
posted @ 2014-04-03 20:47 null1019 阅读(186) 评论(0) 推荐(0)