➤ Problem Link : 1327A. Sum of Odd Integers
✅ C++ Solution :
#include<bits/stdc++.h> using namespace std; #define ll long long int int main() { int t; cin>>t; while(t--) { ll n,k; cin>>n>>k; if(n%2==1) { if(k%2==0) cout<<"NO\n"; else { ll val=k*k; if(n>=val) cout<<"YES\n"; else cout<<"NO\n"; } } else { if(k%2==1) cout<<"NO\n"; else { ll val=k*(k); if(n>=val) cout<<"YES\n"; else cout<<"NO\n"; } } } }
Thank you for your patience reading. If you enjoyed this post, I’d be very grateful if you’d help it spread by emailing it to a friend, or sharing it on Whatsapp or Facebook.
😇Happy Learning!!