摘要:题目:Problem DescriptionQueues and Priority Queues are data structures which are known to most computer scientists. The Queue occurs often in our daily life. There are many people lined up at the lunch time.Now we define that ‘f’ is short for female and ‘m’ is short for male. If the queue’s length is
阅读全文
摘要:PS:很多版本的方案都是:long long sum(int x) { long long k=0; while (x #include#includelonglongf[100005];intn;intlowbit(intx){retur...
阅读全文
摘要:A:A. Nutstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou haveanuts and lots of boxes. The boxes have a wonderful feature: if you putx(x ≥ 0)divisors (the spacial bars that can divide a box) to it, you get a box, divided intox + 1sections.You a
阅读全文
摘要:完全没看出是状态压缩DP,果然没练习,之前一直再看,看来要把状压做几道了,上代码吧:代码也是问道的无语。。。#include#include#include#includetypedeflonglongll;usingnamespacestd;intnum[11],val[11];lldp[60000][100];intmain(){lln;intm;cin>>n>>m;while(n){num[n%10]++;n/=10;}val[0]=1;for(inti=1;i=num[j])continue;for(intk=0;k<m;k++)dp[i+val[j]][
阅读全文
摘要:这个纯属个人好玩所写 上次看到有大神说1-10^18的素数比较密集,所以TEST了一下 先是1—10^7素数最大的距离 #include#include#includeusingnamespacestd;constintmaxn=1E7;intb[maxn],q[maxn],cnt;intmain(){for(inti=2;i*i<=maxn;i++)if(b[i]==0){q[++cnt]=i;for(intj=i+i;j<=maxn;j+=i)b[j]=1;}intans=0;for(inti=1;i<=cnt;i++)ans...
阅读全文