摘要:
题目意思 1到N 不包含 13 作为字串并且 是13的倍数#include<iostream>#include<stdio.h>#include<cstring>#include<algorithm>using namespace std;long long N,arr[32],dp[32][3][13];long long DFS( int pos,int flag,int t,int limit ){ if( pos == -1 ) { if( flag == 2 && t == 0 )return 1; return 0; 阅读全文
2013年4月27日
2013年4月26日
摘要:
不要 4 和 62 #include<iostream>#include<stdio.h>#include<algorithm>#include<cstring>using namespace std;int arr[20],dp[20][3];int pow( int num ){ int ans = 1; for( int i = 0; i < num;i++ ) ans*=10; return ans;}int DFS( int pos,int flag, int end ){ if( pos == -1 ){return (flag 阅读全文
摘要:
题目链接 http://acm.hrbeu.edu.cn/index.php?act=status&cid=115保留 最大值 最小值 和 区间个数的线段树; #include<iostream>#include<cstring>#include<stdio.h>#include<cstring>using namespace std;int N,M,arr[2512345],res;struct date{ int Max,Min,Num,sum,lt,rt;}node[11234567];inline int max( int a,i 阅读全文
摘要:
题目链接 http://www.acmore.net/problem.php?id=1488#include<iostream>#include<stdio.h>#include<cstring>#include<algorithm>#define M 1000000007using namespace std;long long arr[32],dp[32];long long D2( long long num ){ long long ans = 1; for( int i = 1; i <= num; i++ ) ans *= 10 阅读全文
摘要:
题目链接 http://www.acmore.net/problem.php?id=1494#include<iostream>#include<stdio.h>#include<cstring>#include<algorithm>using namespace std;int N,K;double ai[1123456],bi[1123456],res[1123456],dp[1123456];bool DO( double mid ){ dp[0] = 0; res[0] = 0; for( int i = 1; i <= N; i+ 阅读全文
摘要:
题意 就是给你 N 个病毒,求有多少字串不包含病毒串; abc 病毒 aabcd 算包含病毒方法 传递最小值#include<iostream> #include<stdio.h> #include<cstring> #include<algorithm> using namespace std; char str[1123456],cha[112345]; long long head,tail,total; struct date { date *fail,*next[26]; long long len; }tree[112345],*qu 阅读全文
摘要:
#include<iostream>#include<stdio.h>#include<cstring>#include<algorithm>using namespace std;int N,K;struct date{ double ai,bi;}node[1111];double arr[1111];bool DO( double mid ){ for( int i = 1; i <= N; i++ ) arr[i] = node[i].ai - mid*node[i].bi; sort( &arr[1],&arr[1 阅读全文
2013年4月21日
摘要:
题意 意思 就是 给你一数字,问从 0 到 N 有多少个数字 出现了49;解题方法 由于有2^64 所以 不要想打表了,用数位dp 吧! 具体我用了两种方法;说实话,这题 卡了我很久才想通;我用了两种思路,第二种思路,纯属原创,第一种方法,和戴神在ACdream 的一次解题报告一样;不熟悉的话,数位dp 看来也不简单;数位 dp 首先 一个758457932 则可以看作是 700000000 + 50000000 + 8000000........这样从高位枚举每一个数字,也就是说 先从 0 ~ 100000000 先考虑,然后再 100000000~2000000... 阅读全文
2013年4月17日
摘要:
解题 方法 因为只有 3 所以我列举了所有状态 000 111001 100110 011 每一层只有 6个状态;简化了 搜索的过程链接 http://poj.org/problem?id=2663 1 #include<iostream> 2 #include<stdio.h> 3 #include<cstring> 4 #include<algorithm> 5 using namespace std; 6 7 int N,dp[33][8]; 8 int work( ) 9 {10 memset(dp,0,sizeof(dp));11 dp 阅读全文
2013年4月13日