#include<stdio.h> #include <string.h> #include <math.h> int main(){ int n; int i; int k; while(scanf("%d",&n)!=EOF){ if(n==0) break; k=0; for(i=2;i<=n;i++){ k=(k+3)%i; } printf("%d\n",k+1); } printf("\n"); return 0; } |
Double click to view unformatted code.