#include<queue> #include<iostream> using namespace std; int main(){ int n; while(cin>>n && n!=0){ int res=0; for(int i=2;i<=n;i++){ res=(res+3)%i; } cout<<res+1<<endl; } }
Double click to view unformatted code.