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

请问到底为什么会是Output Limit Exceed,我查了好久没找到不一样的格式呀

Posted by bitsf at 2004-10-09 20:40:48 on Problem 1607
#include <stdio.h>
#define MAXSHU 100000

char result[MAXSHU][10];

void printresult(int shu)
{
	if(shu>=MAXSHU)
		shu=MAXSHU-1;
	for(int i=0;i<10;i++)
		printf("%c",result[shu][i]);
}

void makeresult()
{
	double xiaoshu=0;
	double sum=0;
	for(int n=1;n<MAXSHU;n++)
	{
		xiaoshu=0.5/n;
		sum+=xiaoshu;
		result[n][9]=(int)((sum+0.0005)*1000)%10+'0';
		result[n][8]=(int)(sum*100)%10+'0';
		result[n][7]=(int)(sum*10)%10+'0';
		result[n][6]='.';

		result[n][5]=(int)sum%10+'0';
		result[n][4]=' ';
		result[n][3]=' ';
		result[n][2]=' ';
		result[n][1]=' ';
		result[n][0]=' ';

	
	}
}

void main()
{
	int shu;
	int n=0;

	makeresult();
	printf("Cards  Overhang\n");
	while(scanf("%d",&shu))
	{
		printf("%5d",shu);
		printresult(shu);
		printf("\n");
		
	}
}

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