雕刻时光

just do it……nothing impossible
随笔 - 547, 文章 - 0, 评论 - 82, 阅读 - 86万
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

08 2011 档案

摘要:比赛的时候,想到用表的方法进行统计,但是直到最后还是没敢敲先打表生成一个幸运数的表再枚举幸运数的表进行统计注意打表时会超int,果断__int64View Code #include<iostream>#include<algorithm>using namespace std;__int64 pl,pr,vl,vr,k;__int64 len=0;__int64 c[10009];void dfs(__int64 n)//生成4,7...的表{ if(n>pr&&n>vr) return; c[len]=n; len++; dfs(n*10 阅读全文

posted @ 2011-08-30 16:06 huhuuu 阅读(273) 评论(0) 推荐(0) 编辑

摘要:上届:最大的饼的面积下届:0二分。。。注意的是while条件与整数的二分查找有区别(r-l)>0.00001取PI的技巧:const double PI=acos(-1.0);View Code #include<stdio.h>#include<math.h>const double PI=acos(-1.0);double a[10009];int n,m;double ss(double r){ return r*r*PI;}int much(double s)//当面积为S时可以把这些饼分成几个有效饼{ int i; int add=0; for(i=0; 阅读全文

posted @ 2011-08-29 21:51 huhuuu 阅读(420) 评论(0) 推荐(0) 编辑

摘要:题目要求如何将月份分组就可以 使月份中的最大值最小二分查找上届:sum(a[i])下届:max(a[i])while(l<=r){ if(求的组别大于 题目要求) l=mid+1; else r=mid-1; ....统计(随时记录符合条件的月份中的最大值 的最小值)}注意 count<=m时就可以更新,count<m时一定可以分成m组View Code #include<stdio.h>int a[100009];int rmax;int zu(int max,int n)//可以分成几组{ int i; int add=1,t=0; rmax=0; ... 阅读全文

posted @ 2011-08-29 16:40 huhuuu 阅读(232) 评论(0) 推荐(0) 编辑

摘要:哈密顿回路判断是个NP问题,只有爆搜才可以N=64,显然直接爆搜不行AAAA……其实可以缩成一个点ACACAC……缩成两个点(如单独存在A,C就需要两个AC)ACGACGACG……缩成三个点(如单独存在A,C,G就需要三个ACG)再DFS即可View Code #include<stdio.h>#include<string.h>int add[10];int ok=0;int all=0;int from;void fun(char ss[10]){ int i; int t=0; for(i=0;ss[i];i++) { if(ss[i]=='A') 阅读全文

posted @ 2011-08-29 14:22 huhuuu 阅读(2874) 评论(0) 推荐(1) 编辑

摘要:hash+置换群View Code #include<stdio.h>#include<string.h>int a[10009];int hash[100009];bool use[100009];int min1(int a,int b){ if(a>b)return b; else return a;}int main(){ int n; while(scanf("%d",&n)!=EOF) { int i,min=9999999,max=0; memset(hash,0,sizeof(hash)); memset(use,0,s 阅读全文

posted @ 2011-08-17 10:18 huhuuu 阅读(390) 评论(0) 推荐(0) 编辑

摘要:统计正方形个数 set做结构体要加:friend bool operator<(data a,data b) { if(a.x==b.x) return a.y>b.y; else return a.x>b.x; }枚举正方形的两个点 知道下面两个点寻找set中这两个点是否存在View Code #include<stdio.h>#include<string.h>#include<iostream>#include<set>using namespace std;struct data{ int x,y; friend boo 阅读全文

posted @ 2011-08-16 20:43 huhuuu 阅读(347) 评论(0) 推荐(0) 编辑

摘要:死亡游戏,问一把左轮枪,左轮有N个空间,其中用k发子弹,有p个问题,问抢第a[i]个空间有木有子弹,小明为了使自己被秒的概率最小,如何摆放子弹(游戏会一直继续知道有人挂掉),答案要按字典序显示。。。 分类思想吧 7 0 7(为了方便1-7顺序) 。。。。。。。 7 1 7 。。。。。。X 7 2 7 。。。。。XX 7 3 7 。。。X。XX 7 4 7 。X。X。XX ... 8 0 8 不写了,把情况都列一下,总结规律View Code #include<stdio.h>int main(){ __int64 n,k,p; int i; scanf("%I64d%I6 阅读全文

posted @ 2011-08-08 16:57 huhuuu 阅读(239) 评论(0) 推荐(0) 编辑

摘要:先写个暴力的,明天写个hash,或是后缀数组View Code #include<stdio.h>#include<iostream>#include<string.h>#include<queue>#include<stack>#include<set>#include<algorithm>using namespace std;char ss[30009];char cc[30009];int main(){ int n; while(scanf("%d",&n)!=EOF) { 阅读全文

posted @ 2011-08-05 22:26 huhuuu 阅读(265) 评论(0) 推荐(0) 编辑

摘要:经典的dp,对我这种菜鸟有难度啊。。。由于石头可以围成一个环,所以要原来数据*2用记忆化搜索,其实就是dpView Code #include<stdio.h>#include<string.h>int a[209];int maxdp[209][209];int mindp[209][209];int sum[209][209];int max(int a,int b){ if(a>b)return a; else return b;}int min(int a,int b){ if(a>b)return b; else return a;}int dfs 阅读全文

posted @ 2011-08-02 18:13 huhuuu 阅读(1662) 评论(0) 推荐(0) 编辑

摘要:在家没事干就要多做做比赛才是。。。 C题是搜索题 N个数字之间放N-1个"+","-","*" ,"/" 使每位不存在为k的数字。。。 注意点,超int,注意除数不为0,当结果为0是特判 //long long 注意0#include<stdio.h>#include<iostream>#inclu 阅读全文

posted @ 2011-08-01 22:37 huhuuu 阅读(443) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示