Problem Description
有一张
n 个点的完全无向图,点的标号是 1...n,其中边 (i,j) 的长度是 i xor j,现在你需要求出点 1 到点 n 的最短路的长度。
Input
第一行一个正整数
T 表示数据组数 1≤T≤100
对于每组数据:第一行一个正整数 n 表示点数 (2≤n≤105)
对于每组数据:第一行一个正整数 n 表示点数 (2≤n≤105)
Output
输出
T 行,每行一个整数表示点 1 到点 n 的最短路
Sample Input
1 3
Sample Output
2
#include <bits/stdc++.h> #include <iostream> #include <algorithm> #include <cstdio> #include <string> #include <cstring> #include <cstdlib> #include <map> #include <vector> #include <set> #include <queue> #include <stack> #include <cmath> const int INT=1e6+5; typedef long long ll; #define pql priority_queue<ll> #define pq priority_queue<int> #define v vector<int> #define vl vector<ll> #define lson rt<<1, l, m #define rson rt<<1|1, m+1, r #define read(x) scanf("%d",&x) #define lread(x) scanf("%lld",&x); #define pt(x) printf("%d\n",(x)) #define yes printf("YES\n"); #define no printf("NO\n"); #define gcd __gcd #define cn cin>> #define ct cout<< #define en <<endl #define rep(j,k) for (int i = (int)(j); i <= (int)(k); i++) #define input(k) for (int i = 1; i <= (int)(k); i++) {cin>>a[i] ; } #define mem(s,t) memset(s,t,sizeof(s)) #define re return 0; #define TLE std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); #define mod(x) ((x)%9973) using namespace std; const int maxn =11; int n,t; int main() { for(cn t;t;t--) { cn n; ct (n^1) en; } re; }