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 |
Re:转载 算法In Reply To:Re:转载 算法 Posted by:jsmingzi at 2009-02-06 21:36:12 我也是用这种算法,但是第二组数据就是通不过,为什么呢?真是太郁闷了!!!!!!! #include<iostream> using namespace std; int main() { int n,m,k; while(cin>>n>>k>>m&&n||m||k) { int x=1; int i,p; for(i=2;i<=n;i++) { if(i==n) p=k%i; else p=m%i; x=(x+p)%i; if(x==0) x=i; } cout<<x<<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