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> #include<string.h> struct P { char name[16]; }p[65]; int main() { int n,w,s,i,t,m,k; scanf("%d",&n); for(i=0;i<n;i++) scanf("%s",p[i].name); scanf("%d,%d",&w,&s); t=w-1; while(n!=0) { t=(t+s-1)%n; printf("%s\n",p[t].name); for(i=t;i!=n-1;i++) { p[i].name[0]='\0'; strcpy(p[i].name,p[i+1].name); } n--; if(t==n) t=1; } system("pause"); return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator