数据太大 找规律
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long LL;
const int maxn = 10005;
const int Mod = 1000000007;
int n,m,A;
int main()
{
#ifndef ONLINE_JUDGE
freopen("data.txt","r",stdin);
#endif
while( scanf("%d",&n) != EOF )
{
int temp = 2;
while( n >= temp )
temp *= 2;
temp /= 2;
printf("%d\n",1+(n-temp)*2 );
}
return 0;
}
常规约瑟夫环代码 这题过不了
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long LL;
const int maxn = 10005;
const int Mod = 1000000007;
int n,m,A;
int main()
{
#ifndef ONLINE_JUDGE
freopen("data.txt","r",stdin);
#endif
while( scanf("%d",&n) != EOF )
{
m = 2;
int ans = 0;
for( int i = 2; i <= n; i ++ )
ans = (ans+m)%i;
printf("%d\n",ans+1);
}
return 0;
}