Started with Codeforces educational round 118, finished a and b
This commit is contained in:
61
codeforces/educational_rounds/118/a.cpp
Normal file
61
codeforces/educational_rounds/118/a.cpp
Normal file
@@ -0,0 +1,61 @@
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
void test_case(int tc){
|
||||
int x, y, xZeroes, yZeroes;
|
||||
cin >> x >> xZeroes >> y >> yZeroes;
|
||||
|
||||
int xLength = log10(x) + 1 + xZeroes;
|
||||
int yLength = log10(y) + 1 + yZeroes;
|
||||
|
||||
if(xLength > yLength){
|
||||
cout << ">\n";
|
||||
return;
|
||||
} else if(xLength < yLength){
|
||||
cout << "<\n";
|
||||
return;
|
||||
}
|
||||
|
||||
int minZeroes = min(xZeroes, yZeroes);
|
||||
xZeroes -= minZeroes;
|
||||
yZeroes -= minZeroes;
|
||||
|
||||
double dx, dy;
|
||||
|
||||
if(x > y){
|
||||
dx = (double)x / pow(10, yZeroes);
|
||||
dy = y;
|
||||
} else{
|
||||
dx = x;
|
||||
dy = (double)y / pow(10, xZeroes);
|
||||
}
|
||||
|
||||
if(dx > dy){
|
||||
cout << ">";
|
||||
} else if(dx < dy){
|
||||
cout << "<";
|
||||
} else{
|
||||
cout << "=";
|
||||
} cout << "\n";
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main(){
|
||||
ios::sync_with_stdio(0);
|
||||
cin.tie(0);
|
||||
|
||||
int t;
|
||||
cin >> t;
|
||||
|
||||
for(int tc = 1; tc <= t; ++tc){
|
||||
test_case(tc);
|
||||
}
|
||||
|
||||
cout << flush;
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user