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 200530720332 at 2006-08-10 23:04:37 on Problem 1006
In Reply To:Re:下面这组数据的答案是什么?这好像是一个细节 Posted by:200530720332 at 2006-08-10 23:02:17
#include"stdio.h"
#include"math.h"
int m=0, c[10000000]={0};
main()
{
	int p, e ,i, n, j, k, w=0,mm=0;
	scanf("%d",&p);
	scanf("%d",&e);
	scanf("%d",&i);
	scanf("%d",&n);
	while(p!=-1&&e!=-1&&i!=-1&&n!=-1)
	{
		m++;
		w=mm=0;
		if(p==0)
			k=j=23;
		else k=j=p;
		for(;k>0;k-=23)
		{
			if((abs(k-e)%28==0)&&(abs(k-i)%33==0)&&k>n)
			{
				w=1;
				mm=k;
			}
		}
	for(;w==0;j+=23)
	{
		if((abs(j-e)%28==0)&&(abs(j-i)%33==0)&&j>n)//这里!!!
		{
			mm=j;
			break;
		}
	}
	c[m]=mm-n;
	printf("Case %d: the next triple peak occurs in %d days.\n",m,mm-n);
	scanf("%d",&p);
	scanf("%d",&e);
	scanf("%d",&i);
	scanf("%d",&n);
	
	//for(i=1;i<=m;i++)
	}
}
非常感谢
通过你的数据我找到错误!!!!
我循环变量原来有上界的

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