#include<bits/stdc++.h> using namespace std; typedef long long ll; int main (){ int n; while(~scanf("%d", &n)&&n){ int s = 0; for(int i = 1;i <= n;i++){ s = (s+3)%i; } printf("%d\n", s+1); } return 0; } |
Double click to view unformatted code.