#include <bits/stdc++.h> typedef long long ll; const int maxx = 100010; const int inf = 0x3f3f3f3f; const int mod = 1000000009; using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int t; cin >> t; while (t--) { int n; cin >> n; cout << n << endl; } return 0; }
#include <bits/stdc++.h> typedef long long ll; const int maxx = 100010; const int inf = 0x3f3f3f3f; const int mod = 1000000009; using namespace std; int a[maxx], b[maxx]; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int t; cin >> t; while (t--) { int n; cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; sort(a + 1, a + n + 1); int ans = 1; int cnt = n; for (int i = n; i >= 1; i--) { if ((n - i) % 2 == 0) b[i] = a[ans++]; if ((n - i) % 2 == 1) b[i] = a[cnt--]; } for (int i = 1; i <= n; i++) { cout << b[i] << " "; } cout << endl; } return 0; }
#include <bits/stdc++.h> typedef long long ll; const int maxx = 100010; const int inf = 0x3f3f3f3f; const int mod = 1000000009; using namespace std; int a[maxx]; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int t; cin >> t; while (t--) { int n; cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; int minn = a[n]; int flag = 0, ret = 0; for (int i = n - 1; i >= 1; i--) { if (a[i] > minn) flag = 1, ret = max(ret, a[i] - minn); else minn = min(a[i], minn); } if (!flag) cout << 0 << endl; else { int x = 1, cnt = 0; while (ret > 0) { ret -= x; x *= 2; cnt++; } cout << cnt << endl; } } return 0; }
#include <bits/stdc++.h> typedef long long ll; const int maxx = 100010; const int inf = 0x3f3f3f3f; const int mod = 1000000009; using namespace std; vector<ll> G[maxx]; vector<ll> ans; ll deep[maxx], vis[maxx]; int dfs(ll u, ll pre) { deep[u] = deep[pre] + 1; vis[u] = pre; for (auto v : G[u]) { if (G[v].size() == 1) ans.push_back(u); if (v == pre) continue; dfs(v, u); } } int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, u, v; cin >> n; for (int i = 1; i < n; i++) { cin >> u >> v; G[u].push_back(v); G[v].push_back(u); } deep[0] = -1; dfs(1, 0); ll f = 0, cnt = 0, tot = 0; for (int i = 1; i <= n; i++) { if (G[i].size() == 1 && deep[i] % 2 == 0) cnt++; if (G[i].size() == 1 && deep[i] % 2) tot++; } if (cnt >= 1 && tot >= 1) f = 1; if (f != 0) cout << "3 "; else cout << "1 "; sort(ans.begin(), ans.end()); ll ma = n - 1; for (int i = 0; i < ans.size(); i++) if (i) { if (ans[i] == ans[i - 1]) --ma; } cout << ma; return 0; }