problemcutter

导航

2015年3月8日 #

SPOJ Problem 7406:Beehive Numbers

摘要: 阅读题。。加上等差数列判断。。#include#includeint n,s;int main(){ while(scanf("%d",&n)&&n!=-1){ n--; if (n%6){printf("N\n");continue;} n/=3; ... 阅读全文

posted @ 2015-03-08 18:53 problemcutter 阅读(125) 评论(0) 推荐(0)

SPOJ Problem 6256:Inversion Count

摘要: 逆序对裸题。可以用树状数组做,但树状数组是以数据的大小为下标,时间复杂度为O(n log n)(n=max(a[i])),总体来说还是归并好一些。#include#includeint a[200005],b[200005],n,t;int i;long long ans;void count(in... 阅读全文

posted @ 2015-03-08 16:53 problemcutter 阅读(159) 评论(0) 推荐(0)

SPOJ Challenge 378:Size contest

摘要: 挑战压代码能力。。#includeint n,x,tot;int main(){ scanf("%d",&n); while(n--)if(scanf("%d",&x)&&x>0)tot+=x; printf("%d\n",tot);} 阅读全文

posted @ 2015-03-08 15:39 problemcutter 阅读(105) 评论(0) 推荐(0)

SPOJ Problem 2178:He is offside!

摘要: http://www.spoj.com/problems/OFFSIDE/阅读题。。#include#includeint x,a,b,c,n,m,i;int main(){ while(scanf("%d%d",&n,&m)&&(n+m)){ a=b=c=100000; ... 阅读全文

posted @ 2015-03-08 15:33 problemcutter 阅读(166) 评论(0) 推荐(0)

SPOJ Problem 328:Bishops

摘要: 在棋盘上尽可能地摆主教,要求互不攻击高精度,注意0和1。#include#includechar s[105];int l,i,j,a[105];int main(){ while(scanf("%s",&s)!=EOF){ l=strlen(s); memset(a,0,size... 阅读全文

posted @ 2015-03-08 15:02 problemcutter 阅读(171) 评论(0) 推荐(0)