BS_SORT LONG E
kaziamir
c_cpp
a year ago
961 B
6
Indexable
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <functional> using namespace __gnu_pbds; using namespace std; typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; typedef pair<int, int> pi; #define int long long #define endl "\n" void oj(){ #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif } void solution(){ int n, k; cin>>n>>k; if(k<n){ cout<<k<<endl; } else if(n==k){ cout<<k+1<<endl; } else if(n==2){ cout<<(k*2)-1<<endl; } else{ } } int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); // oj(); int tcase = 1; cin >> tcase; for (int tc = 1; tc <= tcase; tc++){ // cout<<"Case "<<tc<<": "; solution(); } }
Editor is loading...
Leave a Comment