View Code of Problem 3309

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stdbool.h>
typedef struct{
	char name[20];
	int flag;
}Children;
int main(){
	Children child[100];
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%s",&child[i].name);
		child[i].flag=0;
	}
	int w,s;
	scanf("%d,%d",&w,&s);
	int start=w-1;
	int all=n;
		int count=0;
		for(int i=start;i<n;i++){
			if(child[i].flag==0){
				count++;
				if(count==s){
					printf("%s\n",child[i].name);
					count=0;
					child[i].flag=-1;
					all--;
				}
			}
			if(all==0)
			break;
			if(i==n-1){
				i=-1;
			}
		}
	
} 




	

Double click to view unformatted code.


Back to problem 3309