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> #include<stdlib.h> typedef struct { char c; int x; int y; }Node; main() { int time; scanf("%d",&time); Node *p=NULL; int *result=NULL; while(time-->0) { int n=0; int i=0; int j=0; int max=0; int min=1000; Node *p=NULL; int *result=NULL; scanf("%d",&n); p=(Node *)malloc(n*sizeof(Node)); for(i=0;i<n;i++) { fflush(stdin); scanf("%c",&p[i].c); scanf("%d %d",&p[i].x,&p[i].y); if(max<p[i].y) max=p[i].y; if(min>p[i].x) min=p[i].x; } result=(int *)malloc((max-min)*sizeof(int)); for(i=0;i<max-min;i++) result[i]=0; for(i=0;i<n;i++) for(j=p[i].x;j<p[i].y;j++) result[j-min]++; for(i=0;i<max-min;i++) { if(result[i]<1) continue; printf("%c",result[i]+'A'-1); } printf("\n"); free(p); free(result); } return 1; } 帮个忙,指点一下哪里错了吧,RE.... Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator