上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 21 下一页
摘要: http://poj.org/problem?id=2352题意:给出每个星星在平面内的坐标(x,y)(y递增,y相同时,x递增)。每颗星星的级别定义为,横纵坐标均不超过自己的星星个数(不包括自己),求级别为0~N-1的星星分别有多少个。 1 #include 2 const int N=32001; 3 int n,c[N],level[N]; 4 int lowbit(int x) 5 { 6 return x&(-x); 7 } 8 int sum(int x)//求和 9 {10 int s = 0;11 while(x>0)12 {13 ... 阅读全文
posted @ 2014-01-16 17:40 N_ll 阅读(175) 评论(0) 推荐(0)
摘要: http://poj.org/problem?id=3371 1 #include 2 #include 3 #include 4 using namespace std; 5 const int N=102; 6 bool is_sen(char ch)//判断是否为句子 7 { 8 if (ch=='.'||ch=='!'||ch=='?'||ch==':'||ch==';') 9 return true;10 return false;11 }12 bool is_vowel(char ch)//判断是否是元 阅读全文
posted @ 2013-12-19 14:56 N_ll 阅读(363) 评论(0) 推荐(0)
摘要: http://poj.org/problem?id=2516题意:N位店主,M个供应商品的地方,每个地方能供应K种商品,不同地方的不同的商品供应给不同的店主有不同的花费,如果这些店主能被供应,输出最小的花费,否则输出-1.思路:N位店主: 用编号为0~n-1的点表示 M个供应商品的地方:用编号为 m~m+n-1的点表示 m+n 代表超级源点,m+n+1 代表终极汇点 用这些点建图,求最小费用最大流 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 const int maxn=120; ... 阅读全文
posted @ 2013-12-19 11:41 N_ll 阅读(236) 评论(0) 推荐(0)
摘要: http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2719 1 #include 2 #include 3 const int N=1010; 4 using namespace std; 5 int a[N],b[N],f[N]; 6 int main() 7 { 8 int n1,n2,m,o=0; 9 while(~scanf("%d %d %d",&n1,&n2,&m))10 {11 o++;12 int flag1 = 0,flag2... 阅读全文
posted @ 2013-12-03 15:42 N_ll 阅读(174) 评论(0) 推荐(0)
摘要: http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2718题意:如果没有障碍就按原方向直走,否则就右转直走,若右边走不通就左转直走,若左边也走不通就后转直走,直到走出去。 1 #include 2 #include 3 const int N=50; 4 using namespace std; 5 int a[N][N]; 6 int main() 7 { 8 int n,m,k,x,y,p=0; 9 while(~scanf("%d %d %d",&n,& 阅读全文
posted @ 2013-12-03 15:38 N_ll 阅读(168) 评论(0) 推荐(0)
摘要: http://codeforces.com/problemset/problem/368/BB. Sereja and Suffixestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputSereja has an array a, consisting of n integers a1, a2, ..., an. The boy cannot sit and do nothing, he decided to study an array. S 阅读全文
posted @ 2013-11-29 21:54 N_ll 阅读(247) 评论(0) 推荐(0)
摘要: http://poj.org/problem?id=3191题意:将一个整型的十进制整数转化为-2进制整数。 1 #include 2 #include 3 #include 4 #include 5 #define LL long long 6 using namespace std; 7 int main() 8 { 9 LL n,s[1010];10 while(~scanf("%lld",&n))11 {12 memset(s,0,sizeof(s));13 if (n==0)14 {15 ... 阅读全文
posted @ 2013-11-25 22:03 N_ll 阅读(222) 评论(0) 推荐(0)
摘要: http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2493 1 #include 2 #include 3 #include 4 using namespace std; 5 const int maxn=1010; 6 const int maxm=maxn*maxn; 7 const long long INF=1LLq;31 q.push(s);32 vis[s] = 1;33 dis[s] = 0;34 while(!q.empty())35 {36... 阅读全文
posted @ 2013-11-25 15:52 N_ll 阅读(127) 评论(0) 推荐(0)
摘要: http://poj.org/problem?id=1201题意:给定n个整数闭区间[a,b]和n个整数c,求一个最小的整数集合Z,满足Z里边的数中范围在闭区间[a,b]的个数不小于c个。思路:根据题目描述,可建模成一个差分约束系统。设S[i]表示小于等于i的整数的个数,R表示最大的右端点值,L表示最小的左端点值:则 S[b] - S[a-1] >= c;转化成:S[a-1] - S[b] = 0;转化成:S[i-1] - S[i] = M,即 S[L-1] - S[R] 2 #include 3 const int N=50005; 4 const int INF=1 dis[u]+e 阅读全文
posted @ 2013-11-24 14:07 N_ll 阅读(240) 评论(0) 推荐(0)
摘要: http://poj.org/problem?id=1364题意:输入i,n,gt(lt),k; 判断是否存在这样一个序列,从第 i 项加到第 n+i 项的和 (gt) k.思路: 由题意知gt: Sn+i - Si > k;.......(1)lt: Si - Sn+i 建图。 1 #include 2 #include 3 const int N=120; 4 const int INF=1 dis[u]+edge[j].w)//更新各点到源点的距离30 dis[v] = dis[u]+edge[j].w;31 }32 }33 ... 阅读全文
posted @ 2013-11-24 11:51 N_ll 阅读(173) 评论(0) 推荐(0)
上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 21 下一页