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 |
系统时间是什么算的? 两个程序明明是一样的嘛,为何一个能过一个不能过。#include <stdio.h> void main (){ int kill,k,n,p; long m; scanf ("%d",&k); while (k!=0&&k<=13){ for (m=k+1;;m++){ kill=1;p=0; for (n=0;n<=(k-1);n++){ kill=(kill-1+m)%(2*k-n); if (kill==0) kill=2*k-n; else if (kill<=k) {p=1;break;} } if (p!=1) break; } printf ("%ld\n",m); scanf ("%d",&k); } } 编者——李(大意)! #include<stdio.h> void main() { int k,n,m,i,a[16],s[20]; for(k=1;k<=13;k++) { a[1]=2*k; for(i=2;i<16;i++) a[i]=a[i-1]-1; for(n=k;;n++) { m=n; for(i=1;i<=k;i++) { if(n%a[i]>0&&n%a[i]<=k) goto loop; else { if(n%a[i]==0) n=m; else n=m-(a[i]-n%a[i]); } } s[k]=m;break; loop: n=m; } } scanf("%d",&k); while(k!=0) { printf("%d\n",s[k]); scanf("%d",&k); } } 编者——室友! Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator