| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
改成多组的条件是什么?单组的总是WA.可是怎么改成多组的?#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator