感觉建图复杂度过大啊,但还是AC了。。。View Code 1 #include<stdio.h> 2 #include<string.h> 3 char str[210][1010]; 4 int map[210][210]; 5 int min(int a,int b){return a<b?a:b;} 6 const int inf = 9999999; 7 int n,match[210]; 8 bool sx[210],sy[210]; 9 int lx[210],ly[210]; 10 bool path(int u) 11 { 12 sx[u]=tr Read More
posted @ 2011-10-28 20:18 Because Of You Views(286) Comments(0) Diggs(0) Edit
比如第i个学生是 【a b】那就从i向a至b连边左边是学生,右边是排名二分匹配即可View Code 1 #include<stdio.h> 2 #include<string.h> 3 int map[62][100001]; 4 int match[100010]; 5 bool vis[100010]; 6 int mi,mx; 7 bool dfs(int u) 8 { 9 int i;10 for(i=mi;i<=mx;i++)11 {12 if(map[u][i]&&!vis[i])13 {14 vi... Read More
posted @ 2011-10-28 18:50 Because Of You Views(292) Comments(0) Diggs(0) Edit
先记录所有数相乘的质因子,再二分一个x判断x!是否能被M整除View Code 1 #include<stdio.h> 2 #include<string.h> 3 #include<math.h> 4 #define lld __int64 5 lld num[110]; 6 lld a[110],b[110]; 7 void cal(lld n,lld count) 8 { 9 int i,cnt; 10 for(i=2;i*i<=n;i++) 11 { 12 cnt=0; 13 if(n%i==0) 14 ... Read More
posted @ 2011-10-28 16:12 Because Of You Views(334) Comments(0) Diggs(0) Edit
因为两个有重叠的开放时间段的景点不可能在同一天游览完,一天只能游览其中的一个,所以求最大的区间重叠次数就好了View Code 1 #include<stdio.h> 2 #include<string.h> 3 #include<algorithm> 4 #include<iostream> 5 using namespace std; 6 int vis[24*3600+5]; 7 int main() 8 { 9 int n,i,j,s,t;10 while(scanf("%d",&n),n)11 {12 int Read More
posted @ 2011-10-28 13:57 Because Of You Views(246) Comments(0) Diggs(0) Edit
View Code 1 #include<stdio.h> 2 #include<string.h> 3 int map[20][20]; 4 int dx[]={1,1,0,-1,-1,-1,0,1}; 5 int dy[]={0,1,1, 1, 0,-1,-1,-1}; 6 int len=15; 7 int n; 8 bool inside(int x,int y) 9 { 10 return (x>=1&&x<=len&&y>=1&&y<=len); 11 } 12 bool check(i Read More
posted @ 2011-10-28 11:56 Because Of You Views(227) Comments(0) Diggs(0) Edit