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

狠狠的鄙视自己。既然忘记考虑特殊情况 ,报数间隔为1的情况

Posted by chenjin1st at 2011-12-20 14:55:22 on Problem 3750
附代码


#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(){
	char **name;
	int i,n,j,k,start,out,live;
	scanf("%d",&n);
	name=(char **)malloc(n*sizeof(char *));
	for(i=0;i<n;i++){
		name[i]=(char *)malloc(16*sizeof(char));
		scanf("%s",name[i]);
	}
	scanf("%d,%d",&start,&out);
	live=n;k=0;j=start-2;
	while(live>=1){
		while(1){
			j=(j+1)%n;
			if(name[j][0]!='!')
				k++;
			if(k==out){
				printf("%s\n",name[j]);
				name[j][0]='!';
				k=0;
				break;
			}
		}
		live--;
	}
	for(i=0;i<n;i++)
		free(name[i]);
	free(name);
	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