自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Napoleon2004的博客

千里之行,始于足下

  • 博客(158)
  • 收藏
  • 关注

原创 NOIP 2007 提高组 第三题 矩阵取数游戏

#include<bits/stdc++.h>using namespace std;const int M=100;int n,m,b[M],c[M],ans[M],a[M][M];int ord[M][M],sum[M][M],rec[M][M][M],dp[M][M][M][M];bool check(int u,int l,int r){ int i; ...

2018-07-31 22:59:34 346

原创 2001 提高组 统计单词个数

题目描述给出一个长度不超过 200200 的由小写英文字母组成的字母串(约定;该字串以每行 2020 个字母的方式输入,且保证每行一定为 2020 个)。要求将此字母串分成 kk 份( 1<k \le 401<k≤40 ),且每份中包含的单词个数加起来总数最大(每份中包含的单词可以部分重叠。当选用一个单词之后,其第一个字母不能再用。例如字符串 thisthis 中可包含 thist...

2018-07-29 11:10:51 262

原创 2010 提高组 引水入城

只拿了90分,第五个数据点超时 #include<bits/stdc++.h>using namespace std;const int M=510;struct node{ int l,r;}edge[M];int n,m,a[M][M];bool b[M],mp[M][M],vis[M][M];int q[5]={1,0,-1,0},p[5]={0,...

2018-07-29 11:05:56 204

原创 [SDOI2008]仪仗队

题目描述作为体育委员,C君负责这次运动会仪仗队的训练。仪仗队是由学生组成的N * N的方阵,为了保证队伍在行进中整齐划一,C君会跟在仪仗队的左后方,根据其视线所及的学生人数来判断队伍是否整齐(如下图)。  现在,C君希望你告诉他队伍整齐时能看到的学生人数。输入输出格式输入格式: 共一个数N 输出格式: 共一个数,即C君应看到的学生人数。 #incl...

2018-07-29 11:02:51 160

原创 HDU 4474

#include<bits/stdc++.h>using namespace std;struct node{ int p,s,next;}q[1000000];int k,t,n,m,a[10];bool b[10],c[1000000];void out(int num){ if(num==1)return; out(q[num].next);...

2018-07-15 00:01:36 216

原创 HDU 1867

#include<bits/stdc++.h>using namespace std;int const M=100010;int to[M];void getto(char *str){ int i=-1,j=0,len=strlen(str); to[0]=-1; while(j<len-1) if(i==-1||str[i]=...

2018-07-08 11:31:27 173

原创 HDU 2087

#include<cstdio>#include<string>#include<cstring>#include<iostream>using namespace std;int ans,to[1010];void getto(string p) { to[0]=-1; int j=0,k=-1; while(j<p.siz...

2018-07-08 11:29:57 218

原创 HDU 5296

#include<bits/stdc++.h>using namespace std;const int M=100010;map<int,int>mp;map<int,int>::iterator t;struct node{ int d,l,to;}edge[2*M];int len,index,a[M],b[M],dfn[M],dis...

2018-07-08 11:26:37 214

原创 BZOJ 2084

#include<bits/stdc++.h>using namespace std;char s[500010];int main(){ int n,i,l,r,ans=0; scanf("%d\n%s",&n,s+1); for(i=1;i<n;i++){ l=i;r=i+1; while(l>=1&&r<=n&...

2018-07-08 11:24:23 180

原创 BZOJ 2081

#include<bits/stdc++.h>using namespace std;const int b=49999,M=200010;typedef unsigned long long ull;map<ull,bool>mp;int a[M],anss[M];ull sum1[M],sum2[M],power[M];ull get_hush1(int ...

2018-07-08 11:23:23 189

原创 BZOJ 2795

#include<bits/stdc++.h>using namespace std;const int b=233,c=10007,M=500010;typedef unsigned long long ull;char s[M];ull t,sum1[M],sum2[M],power1[M],power2[M];ull get_hush1(int x,int y){ ...

2018-07-08 11:22:27 228

原创 BZOJ 3916

#include<cstdio>#include<cstring>#include<iostream>using namespace std;const int b=101,c=103,M=2000010;typedef unsigned long long ull;ull sum1[M],sum2[M],power1[M],power2[M];c...

2018-07-08 11:21:18 247

原创 POJ 2752

#include<cstdio>#include<cstring>using namespace std;const int b=101,c=103,M=400010;typedef unsigned long long ull;ull sum1[M],sum2[M],power1[M],power2[M];char s[M];int main(){ int...

2018-07-08 11:17:26 123

原创 POJ 2406

#include<iostream>#include<cstdio>#include<cstring>using namespace std;typedef unsigned long long ull;const int b=101,N=1e6+10;char s[N];ull sum[N],power[N];int main(){ int ...

2018-07-08 11:16:28 154

原创 HDU 1696

#include<iostream>#include<utility>#include<cstring>#include<cstdio>using namespace std;typedef unsigned long long ull;const int b=101,M=1e6+9;char s1[M],s2[M];ull s,su...

2018-07-08 11:15:33 183

原创 POJ 2155

#include<cstdio>#include<cstring>#include<iostream>using namespace std;const int M=1010;int n,sum[M][M];void change(int x,int y){ int i,j; for(i=x;i>0;i-=(i&-i)) for...

2018-07-07 22:59:04 180

原创 POJ 2752

#include<cstdio>#include<cstring>using namespace std;const int b=101,c=103,M=400010;typedef unsigned long long ull;ull sum1[M],sum2[M],power1[M],power2[M];char s[M];int main(){ int...

2018-07-01 21:50:15 268

原创 HDU 3694 Network

#include<cstdio>#include<stack>#include<cstring>using namespace std;const int M=100010;int l,l2,type,index,bridge;struct node{ int d,next;}edge[4*M],edge2[4*M];stack<int&...

2018-06-21 16:23:53 157

原创 HDU 5785 Interesting

#include<cstdio>#include<cstring>#include<iostream>#include<algorithm>using namespace std;typedef long long ll;const ll M=1111111,Mod=1000000007;char c[M],s[M<<1];...

2018-06-17 00:41:56 144

原创 HDU 2196 Computer

#include<bits/stdc++.h>using namespace std;const int M=10010;struct node{ int d,l,next;}edge[2*M];int m,a[M],maxn[M],smaxn[M],maxid[M],smaxid[M];void addedge(int i,int j,int k){ edge[++m...

2018-06-17 00:36:10 130

原创 ZOJ 2760 How Many Shortest Path

#include<queue>#include<cstdio>#include<vector>#include<cstring>using namespace std;const int M=110,inf=0x3f3f3f3f;struct node{ int x,y,l;};vector<node>g;int n,...

2018-06-05 20:56:31 154

原创 HDU 4864 Task

#include<bits/stdc++.h>using namespace std;const int M=100010;struct node{ int x,y;}a[M],b[M];int p[110];int cmp(node q,node p){ if(q.x!=p.x)return q.x>p.x; return q.y>p....

2018-06-03 14:53:26 120

原创 UVA11732 "strcmp()" Anyone?

#include<bits/stdc++.h>using namespace std;struct node{ int m,son[70];}p;vector<node>f;int zh(char c){ if(c>='0'&&c<='9')return c-'0'; if(c>='A'&&...

2018-06-01 22:58:51 144

原创 小B的旅行 NOI 1119

#include<bits/stdc++.h>using namespace std;struct node{ int pos,dis;};int n,m,p,ans;bool b[100010];queue<node>q;vector<int>a[100010];void bfs(){ int i; node t; q.push((no...

2018-06-01 22:56:25 593

原创 UVA 3942 Remember the Word

#include<cstdio>#include<cstring>const int M=400010,mod=20071027;char a[M],s[110];int l,d[M],son[M][30];bool h[M];void init(){ l=strlen(a); memset(h,0,sizeof(h)); memset(son,0,siz...

2018-05-31 08:45:56 128

原创 统计难题

Ignatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀).Input 输入数据的第一部分是一张单词表,每行一个单词,单词的长度不超过10,它们代表的是老师交给Ignatius统计的单词,一个空行代表单词表的结束.第二部分是一连串的提问,每行一个提问,每个提问都是一个字符串.注意:本题只有...

2018-05-31 08:44:38 146

原创 Tyvj1305

描述 • 输入一个长度为n的整数序列,从中找出一 段不超过M的连续子序列,使得整个序列的 和最大。   例如 1,-3,5,1,-2,3  当m=4时,S=5+1-2+3=7 当m=2或m=3时,S=5+1=6  输入格式 第一行两个数n,m  第二行有n个数,要求在n个数找到最大子序和 输出格式  一个数,数出他们的最大子序和   测试样例 输入 6 4 1 -3 5 1 -2 3 输出 7 备...

2018-05-30 22:01:48 275

原创 Vijos 生产产品

描述在经过一段时间的经营后,dd_engi的OI商店不满足于从别的供货商那里购买产品放上货架,而要开始自己生产产品了!产品的生产需要M个步骤,每一个步骤都可以在N台机器中的任何一台完成,但生产的步骤必须严格按顺序执行。由于这N台机器的性能不同,它们完成每一个步骤的所需时间也不同。机器i完成第j个步骤的时间为T[i,j]。把半成品从一台机器上搬到另一台机器上也需要一定的时间K。同时,为了保证安全和产...

2018-05-30 21:50:09 148

原创 HDU 3183 A Magic Lamp

#include<bits/stdc++.h>using namespace std;char s[1010],ans[1010];int main(){ int n,m,i,j,l,r,t,p,head,tail; while(scanf("\n%s %d",s,&m)!=EOF){ n=strlen(s);l=0;r=m;tail=0; for(i=1;i...

2018-05-23 22:34:27 109

原创 UVA 11235 Frequent values

#include<bits/stdc++.h>using namespace std;const int M=100010;int a[M],p[M],s[M],dp[M][20];int rmq(int x,int y){ if(x>y)return 0; int k=log2(y-x+1); return max(dp[x][k],dp[y-(1<<...

2018-05-23 22:32:41 129

原创 UVA 3027 Corporative Network

#include<bits/stdc++.h>using namespace std;struct node{ int fat,dis;}a[20010];int find(int x){ if(a[x].fat==x)return x; int t=find(a[x].fat); a[x].dis+=a[a[x].fat].dis; a[x].fat=t; ret...

2018-05-23 22:31:27 131

原创 UVA 3644 X-Plosives

#include<bits/stdc++.h>using namespace std;int fat[100010];int find(int x){ if(fat[x]==0)return x; return fat[x]=find(fat[x]);}int main(){ int x,y,q,p,ans; while(scanf("%d",&x)!=EOF...

2018-05-23 22:30:04 97

原创 BZOJ 2140 稳定婚姻

#include<bits/stdc++.h>using namespace std;const int N=10000;stack<int>s;map<string,int>mp;vector<int>a[N];bool c[N];int t,ind,dfn[N],low[N],kind[N];struct node{    in...

2018-05-23 22:26:44 110

原创 HDU 1023 Train Problem II

#include<bits/stdc++.h>using namespace std;int k[110][1010];void out(int n){ int i; for(i=k[n][0];i>=1;i--) printf("%d",k[n][i]); printf("\n");}void cal(int x,int y,i...

2018-05-21 01:29:39 115

原创 HDU 1452 Happy 2004

#include<bits/stdc++.h>using namespace std;int qpow(int m,int n){ int k=m,s=1; while(n){ if(n&1)s=s*k%29; k=k*k%29; n>>=1; } return s;}int m...

2018-05-21 01:27:56 88

原创 POJ 2480 Longge's problem

#include<cstdio>using namespace std;typedef long long ll;ll p[6010],prime[50010];ll l,d,ans,s[20],k[20],b[20];void get_prime(){ ll i,j; prime[0]=prime[1]=1; for(i=2;i<=50000;i++) if...

2018-05-21 01:25:39 101

原创 Swap

Given an N*N matrix with each entry equal to 0 or 1. You can swap any two rows or any two columns. Can you find a way to make all the diagonal entries equal to 1? Input There are seve...

2018-05-18 09:37:16 165

原创 UVA 11082 Matrix Decompressing

#include<bits/stdc++.h>using namespace std;int r,c,a[30],b[30],pre[50],h[50][50];bool vis[50];int bfs(int s,int t){ int i,p; memset(vis,0,sizeof(vis)); queue<int>q;q.push(s); pre[s...

2018-05-18 09:32:43 134

原创 POJ 1845 Sumdiv

#include<cstdio>using namespace std;typedef long long ll;const int M=9901;ll p[100],k[100];ll power(ll n,ll m){ ll sq=1; while(m){ if(m&1)sq=sq*n%M; m>>=1; n=n*n%M; } re...

2018-05-18 09:27:04 173

原创 POJ 2992 Divisors

#include<cstdio>using namespace std;const int M=431;bool b[M+5];int l,p[M+5],jie[M+5][M+5];void jc(){ int i,j; for(i=2;i<=M;i++) if(b[i]==0){ for(j=i*i;j<=M;j+=i) b[j]=1; ...

2018-05-13 10:07:14 107

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除