Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
网上的一段代码……请教大牛#include<stdio.h> #define SIZE1 32000 #define SIZE2 15000 int c[SIZE1]; int a[SIZE1]; int out[SIZE2]; int n; int lowbit(int k) { return k&(k^(k-1)); } int sum(int k) { int ret=0; while(k>0) { ret+=c[k]; k-=lowbit(k); } return ret; } void change(int pos,int delt) { while(pos<=SIZE1) { c[pos]+=delt; pos+=lowbit(pos); } } void init() { int i; int x,y; for(i=0;i<n;i++) { scanf("%d%d",&x,&y); x++; out[sum(x-1)+a[x]]++; ////////这句话是什么意思…… change(x,1); a[x]++; } } int main() { int i; scanf("%d",&n); init(); for(i=0;i<n;i++) { printf("%d\n",out[i]); } } 他貌似只考虑了x都没考虑y,是我理解错了,还是数据的问题?? Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator