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

请问:为什么很多题目SAMPLE都能过,但就是不AC呢?

Posted by seol at 2004-11-13 21:14:54 on Problem 2013
2013题SAMPLE都没问题,且数组长度也够,还是WA
请问:谁有“离奇”一点的数据啊?谢了:)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
	int n,i,p,q,now;
	long int set=0;
	char *s[15],*str,*san[15];
	scanf("%ld",&n);
	while (n!=0) {
		now=0;set++;
		for (i=0;i<n;i++) {
			str=(char *)malloc(sizeof(char)*26);
			scanf("%s",str);
			s[i]=str;
		}
		p=0;q=n-1;
		if (p==q) printf("%s\n",s[p]);
		else{
			for (i=0;i<n;i++) {
				if (i%2==0) san[i/2]=s[now];
				else san[n-1-(i/2)]=s[now];
				now++;
			}
		}
		printf("SET %ld\n",set);
		for (i=0;i<n;i++) printf("%s\n",san[i]);
		scanf("%d",&n);
	}
	return 0;
}

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