Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:请问,这代码错在哪啊,忘牛人指点

Posted by nwpu_ghost at 2006-09-24 22:48:02 on Problem 2894
In Reply To:请问,这代码错在哪啊,忘牛人指点 Posted by:nwpu_ghost at 2006-09-24 21:27:50
> #include "stdio.h"
> #include "stdlib.h"
> #define N 1001
> int main(){
> 
> 	int test;
> 	int i=0,n,k,j=0;
> 	int x[N];
> 	int a,b;char c;
> 	scanf("%d",&test);
> 	for(i=0;i<test;i++) {
> 		for(j=0;j<N;j++) x[j]=0;
> 		scanf("%d",&n);fflush(stdin);
> 		for(j=0;j<n;j++) {
> 			fflush(stdin);
> 			scanf("%c%d%d",&c,&a,&b);
> 			for(k=a;k<b;k++)
> 				x[k]=x[k]+1;
> 		}
> 		for(j=0;j<N;j++)
> 			if(x[j]>0) 
> 					printf("%c",'A'+x[j]-1);
> 		printf("\n");
> 	}
> 	return 0;
> }
不好意思,已经过了,是fflush(stdin) 的问题

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator