View Code of Problem 3309

#include<stdio.h>
struct queue{
	char name[200];
	int xh;
	int flag;
};
int main(){
	int n,i;
	scanf("%d",&n);
	struct queue a[n];
	for(i=0;i<n;i++){
		scanf("%s",a[i].name);
		a[i].xh=i+1;
		a[i].flag=0;
	}
	int  w,e;
	scanf("%d,%d",&w,&e);
	int k=0,num=0;
	i=w-1;
while(k<5){
		if(num!=e){
			if(a[i].flag==0)
			num++;
		}
		if(num==e){
			if(a[i].flag==0)
			printf("%s\n",a[i].name);
			num=0;
			k++;
			a[i].flag=1;
		}
		if(i==n-1)
		i=0;
		else
		i++;
	}
} 

Double click to view unformatted code.


Back to problem 3309