Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class Fraction {
- private:
- long long x,y;
- int gcd(int a, int b) {
- while (a != 0 && b != 0){
- if (a > b) a = a % b;
- else b = b % a;
- }
- return a + b;
- }
- void normalize() {
- long long nod = gcd (x,y);
- if (x < 0 && y < 0) {x = x * -1;y = y * -1;}
- if (x > 0 && y < 0) {x = x * -1;y = y * -1;}
- x = x / nod;
- y = y / nod;
- }
- public:
- Fraction (long long x = 0, long long y = 1) {
- this->x = x;
- this->y = y;
- }
- Fraction operator + (const Fraction &s) {
- long long a,b;
- b = this->y * s.y;
- a = this->x * s.y + s.x * this->y;
- return Fraction(a,b);
- }
- Fraction operator - (const Fraction &s) {
- long long a,b;
- b = this->y * s.y;
- a = this->x * s.y - s.x * this->y;
- return Fraction(a,b);
- }
- Fraction operator * (const Fraction &s) {
- long long a,b;
- b = this->y * s.y;
- a = this->x * s.x;
- return Fraction(a,b);
- }
- Fraction operator / (const Fraction &s) {
- long long a,b;
- b = this->y * s.x;
- a = this->x * s.y;
- return Fraction(a,b);
- }
- Fraction operator + (long &s) {
- long long a,b;
- b = this->y;
- a = this->x + s * this->y;
- return Fraction(a,b);
- }
- Fraction operator -(){
- long long a,b;
- b = this->y;
- a = this->x * -1;
- return Fraction(a,b);
- }
- bool operator == (const Fraction &s) {
- bool ans;
- long long a,b;
- a = this->x * abs(s.y);
- b = abs(this->y) * s.x;
- if (this->y < 0) a = a * -1;
- if (s.y < 0) b = b * -1;
- if (a == b) ans = true;
- else ans = false;
- return ans;
- }
- bool operator > (const Fraction &s) {
- bool ans;
- long long a,b;
- a = this->x * abs(s.y);
- b = abs(this->y) * s.x;
- if (this->y < 0) a = a * -1;
- if (s.y < 0) b = b * -1;
- if (a > b) ans = true;
- else ans = false;
- return ans;
- }
- bool operator < (const Fraction &s) {
- bool ans;
- long long a,b;
- a = this->x * abs(s.y);
- b = abs(this->y) * s.x;
- if (this->y < 0) a = a * -1;
- if (s.y < 0) b = b * -1;
- if (a < b) ans = true;
- else ans = false;
- return ans;
- }
- friend bool operator < (double d, Fraction &s) {
- bool ans;
- double a,c;
- a = s.x;
- c = s.y;
- a = a/c;
- if (d < a) ans = true;
- else ans = false;
- return ans;
- }
- friend istream & operator >> (istream & input, Fraction &s){
- char z;
- input >> s.x >> z >> s.y;
- }
- friend ostream & operator << (ostream & output, Fraction &s){
- output << s.x << "/" << s.y;
- }
- void show() {
- cout << x << "/" << y;
- }
- void read() {
- char z;
- cin >> x;
- cin >> z;
- cin >> y;
- }
- };
- int main() {
- Fraction a;
- double d;
- cin >> d;
- cin >> a;
- if (d < a) cout << "YES";
- else cout << "NO";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement