Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- using ll = long long;
- using ld = long double;
- const int INF = 1e9;
- //ağ balqabaq boz balqabaq, boz balqabaq ağ balqabaq
- void solve(){
- ll x1,p1; cin >> x1 >> p1;
- ll x2,p2; cin >> x2 >> p2;
- if(x1 == x2){
- if(p1 == p2) cout << "=";
- else if(p1 > p2) cout << ">";
- else cout << "<";
- } else if(x1 > x2){
- //2 hal ola biler. ölçüləri bərabər
- //ölçüləri fərqli
- //y'in ölçüsü böyük ola bilməz. Çünki x1 > x2
- string s = to_string(x1);
- string ss = to_string(x2);
- ll x = (ll)s.size();
- ll y = (ll)ss.size();
- if(x == y){
- if(p1 >= p2) cout << ">";
- else cout << "<";
- return;
- } else if(x > y){
- ll z = x - y;
- if(p2 - p1 < z){
- cout << ">";
- } else if(p2 - p1 > z){
- cout << "<";
- } else {
- //p2 - p1 == z -> yəni ki, ölçülər bərabər
- for(ll i = 0;i<(ll)ss.size();++i){
- char ch = s[i];
- char chh = ss[i];
- ll xx = ch - '0';
- ll yy = chh - '0';
- if(xx > yy){
- cout << ">";
- return;
- } else if(xx < yy){
- cout << "<";
- return;
- }
- }
- cout << "=";
- }
- }
- } else if(x1 < x2){
- string s = to_string(x1);
- string ss = to_string(x2);
- ll x = (ll)s.size();
- ll y = (ll)ss.size();
- if(x == y){
- if(p1 <= p2) cout << "<";
- else cout << ">";
- return;
- } else if(x < y){
- ll z = y - x;
- if(p1 - p2 < z){
- cout << "<";
- } else if(p1 - p2 > z){
- cout << ">";
- } else {
- //p1 - p2 == z
- for(ll i = 0;i<(ll)s.size();++i){
- char ch = s[i];
- char chh = ss[i];
- ll xx = ch - '0';
- ll yy = chh - '0';
- if(xx > yy){
- cout << ">";
- return;
- } else if(xx < yy){
- cout << "<";
- return;
- }
- }
- cout << "=";
- return;
- }
- }
- }
- }
- int main(){
- cin.tie(0) -> sync_with_stdio(0);
- cin.exceptions(cin.failbit);
- //freopen("in.txt","r",stdin);
- //freopen("out.txt","w",stdout);
- int t = 1; cin>>t;
- while(t--){
- solve();
- cout << "\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement