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

改成多组的条件是什么?单组的总是WA.可是怎么改成多组的?

Posted by kkmmnn at 2006-10-03 16:43:16 on Problem 2657
#include<iostream>
using namespace std;
int main()
{
	int N,Z,K,M;
    int o,i;
	cin>>N>>Z>>M;
	int m[1000];
	for(i=0;i<M;i++)
		cin>>m[i];
	for(K=1;!(o==Z);K++)
	{   
		i=0;
		o=1+K;
		while(!(o==Z))
		{  
			if(o>N)
				o=o-N;
		   if(o==m[i])
			   break;
		   if(o<m[i]&&(o+K)>m[i])
			   i++;
		   o=o+K;
		}
    	}
	cout<<K<<endl;
	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