diff --git a/CodeChef Cookoff october/D-or.cpp b/CodeChef Cookoff october/D-or.cpp new file mode 100644 index 0000000..3345661 --- /dev/null +++ b/CodeChef Cookoff october/D-or.cpp @@ -0,0 +1,91 @@ +#include +using namespace std; +typedef long long int ll; +int main(){ + ll t; + cin>>t; + while(t--) + { + ll a,b; + cin>>a>>b; + ll p = 1; + while(pa) + { + cout<<(b|(p-1))<= 0; i--) + { + if(p[i]==q[i]) + { + c[i] = p[i]; + continue; + } + else + { + for(int j = i ; j >=0 ; j--) + { + if(p[j]==1) + { + for(int k = j ; k>=0 ; k--) + { + c[k] = 1; + } + break; + } + else + { + c[j] = 0; + } + } + break; + } + } + ll ans = 0; + for(int i = 63 ; i >= 0 ; i--) + { + ans = ans*2+c[i]; + } + cout< +using namespace std; +typedef long long int ll; +sets; +void precompute() +{ + for(auto it = s.begin(); it != s.end() ; it++) + { + if((*it)*10>(ll)1e18) + { + continue; + } + else + { + s.insert((*it)*10); + } + + if((*it)*20>(ll)1e18) + { + continue; + } + else + { + s.insert((*it)*20); + } + } +} +int main(){ + s.insert(1); + precompute(); + ll t; + cin>>t; + while(t--) + { + ll n; + cin>>n; + if(s.find(n)==s.end()){ + cout<<"No"< +using namespace std; +typedef long long int ll; +int main(){ + ll t; + cin>>t; + while(t--) + { + ll n; + cin>>n; + ll a[n]; + for(int i = 0 ; i< n ; i++) + { + cin>>a[i]; + } + ll indx,indy; + indx = 0; + indy = 0; + ll max = a[0],min = a[0]; + for(int i = 0 ;i < n ; i++) + { + if(a[i]>max) + { + max = a[i]; + indx = i; + } + if(a[i]indy) + { + cout<