无耻的暴力
#include<iostream> #include<cstdio> using namespace std; int n; int main() { freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); cin>>n; int l=500000000; for(int i=0;i<=l;i++) { if(((i*2)^i)==n) { cout<<i*2<<endl; return 0; } if(((i*2+1)^i)==n) { cout<<i*2+1<<endl; return 0; } } fclose(stdin); fclose(stdout); return 0; }
时间: 2024-10-20 23:12:12