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 max 32000 void main(void) { short tr[max*3]={0}; short level[15001]={0}; int i,j,x,y,num,total; scanf("%d",&num); for(i=0;i<num;i++) { scanf("%d%d",&x,&y); for(j=32767+x,total=tr[j],tr[j]++;j>1;j/=2) { //32767是15层的总节点数,第16层放横坐标, if(j%2) total+=tr[j/2]; else tr[j/2]++; } level[total]++; } for(i=0;i<num;i++) printf("%d\n",level[i]); } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator