上一页 1 ··· 44 45 46 47 48 49 50 51 52 ··· 71 下一页
摘要: http://poj.org/problem?id=1905View Code 1 /* 2 (1) 角度→弧度公式 θr = 1/2*s 3 4 (2) 三角函数公式 sinθ= 1/2*L/r 5 6 (3) 勾股定理 r^2 – ( r – h)^2 = (1/2*L)^2 7 整理得 8 9 r = (4*h*h+l*l)/(8*h)10 s = 2rarsin(l/(2*r))11 12 逆向思维解二元方程组:13 14 要求(1)式的h,唯有先求r15 16 但是由于(2)式是三角函数式,直接求r比较困难17 18 因此要用顺向... 阅读全文
posted @ 2013-02-26 19:20 _雨 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 1 int f[15]={1,4,5,9,10,40,50,90,100,400,500,900,1000},num[10]; 2 int co[15][10]={{1},{1,1},{0,1},{1,0,1},{0,0,1},{0,0,1,1},{0,0,0,1},{0,0,1,0,1},{0,0,0,0,1},{0,0,0,0,1,1},{0,0,0,0,0,1},{0,0,0,0,1,0,1},{0,0,0,0,0,0,1}}; 3 char ss[10] = {'I','V','X','L','C', 阅读全文
posted @ 2013-02-25 10:33 _雨 阅读(308) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=3007静态的trie树 静cz提醒 把初始化改了改 不TLE了 分8种情况讨论 有一种就是与源串相同放在最后处理就行View Code 1 #include <iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<stdlib.h> 5 #include<algorithm> 6 using namespace std; 7 struct node 8 { 9 int cout; 10 int next[27]; 1 阅读全文
posted @ 2013-02-20 16:32 _雨 阅读(195) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2115参考人家的 如下如i=65534,当i+=3时,i=1其实就是 i=(65534+3)%(2^16)=1有了这些思想,设对于某组数据要循环x次结束,那么本题就很容易得到方程:x=[(B-A+2^k)%2^k] /C即 Cx=(B-A)(mod 2^k) 此方程为 模线性方程,本题就是求X的值。为了统一令a=C b=B-A n=2^k那么原模线性方程变形为:ax=b (mod n)该方程有解的充要条件为 gcd(a,n) | b ,即 b% gcd(a,n)==0令d=gcd(a,n)有该方程的 最小整数解为 x = e (mod n/ 阅读全文
posted @ 2013-02-19 21:15 _雨 阅读(186) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1836打了一堆 网络连接失败 。。不打了View Code 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<stdlib.h> 5 #include<algorithm> 6 using namespace std; 7 int dp1[1010],dp2[1010],h[1010]; 8 int main() 9 {10 int i,j,k,n;11 double he[1010];12 阅读全文
posted @ 2013-01-29 23:18 _雨 阅读(152) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1276第一种解法 http://blog.csdn.net/lyy289065406/article/details/6648102代码View Code 1 #include <iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<stdlib.h> 5 using namespace std; 6 int c[20],w[20],num[20],cc[100010],dp[100010]; 7 int main() 8 { 阅读全文
posted @ 2013-01-29 17:06 _雨 阅读(275) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2676一列一列的放 判断是否符合条件View Code 1 #include <iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<stdlib.h> 5 using namespace std; 6 char s[20][20]; 7 int vx[20][20],vy[20][20],vis[20][20]; 8 int judge(int x,int y) 9 { 10 if(x>=0&&x< 阅读全文
posted @ 2013-01-27 20:28 _雨 阅读(186) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1129四色定理 最多有四色 从1到四搜View Code 1 #include <iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<stdlib.h> 5 using namespace std; 6 int n,w[100][100],co[100],mi,flag; 7 void dfs(int x,int v) 8 { 9 int i,j,f,k=v;10 if(flag)11 return ;12 if(x>n 阅读全文
posted @ 2013-01-27 19:44 _雨 阅读(137) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2531把第i个节点 放在A集合中 加上没有放在A集合中的节点与之相连的数值 减去已经放在A节点中与之相连的数值View Code 1 #include <iostream> 2 #include<cstdio> 3 #include<cstring> 4 using namespace std; 5 int num[25][25],n,va[50],vb[50],ma,sum; 6 void dfs(int x,int sum) 7 { 8 int i; 9 va[x] = 1;10 for(i = 1 阅读全文
posted @ 2013-01-26 15:27 _雨 阅读(211) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1416乱七八糟的改,乱七八糟的错,最后过了样例 1A了 。对于每个分割开的数来说 有几种组合方式 搜下去View Code 1 #include <iostream> 2 #include<cstdio> 3 #include<cstring> 4 #define INF 10000000 5 using namespace std; 6 int n,m,num[10],sum,g,vis[10],di,tt,mi,f; 7 char oo[10][10],o[10][10]; 8 void dfs(in 阅读全文
posted @ 2013-01-26 15:24 _雨 阅读(128) 评论(0) 推荐(0) 编辑
上一页 1 ··· 44 45 46 47 48 49 50 51 52 ··· 71 下一页