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

模拟。。。。。贴个代码留念下

Posted by crazy852456 at 2012-05-23 09:32:24 on Problem 3750
#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:
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