Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <cstring>
- #include <string>
- #include <cstdio>
- #include <cstdlib>
- #include <cmath>
- using namespace std;
- class Fraction {
- private:
- long long x, y;
- public:
- void normalize() {
- if (y < 0) {
- x = x*(-1);
- y = y*(-1);
- }
- //сокращение дробей по евклиду
- long long a = abs(x), b = abs(y);
- while (a != b) {
- if (a > b) a -= b;
- else b -= a;
- }
- x /= a;
- y /= a;
- }
- Fraction(long long x = 0, long long y = 1) {
- this->x = x;
- this->y = y;
- }
- friend bool operator <(double a, Fraction &s) {
- if (a < ((double) s.x)/ s.y) {
- return true;
- }
- else return false;
- }
- void read() {
- string a;
- string b = "/";
- int i;
- cin >> a;
- i = a.find(b);
- x = stoi(a.substr(0, i));
- y = stoi(a.substr(i + 1));
- }
- };
- int main() {
- double z;
- cin >> z;
- Fraction a;
- a.read();
- if (z < a) cout << "YES";
- else cout << "NO";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement