View Code of Problem 80

#include<bits/stdc++.h>
using namespace std;
#define max 10001
bool cmp(int,int);
int main(){
	
	int M = 3,n,s = 0;
	while(scanf("%d",&n)){
		if(n==0)break;
		for(int i = 2;i<=n;i++){
			s = (s +M)%i;
		}
		printf("%d\n",s+1);
		s = 0;
	}	
	return 0;
} 

Double click to view unformatted code.


Back to problem 80