結果

問題 No.1464 Number Conversion
ユーザー dyktr_06
提出日時 2022-12-10 16:49:29
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,307 bytes
コンパイル時間 1,633 ms
コンパイル使用メモリ 193,288 KB
最終ジャッジ日時 2025-02-09 09:12:38
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 28 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

#define PROBLEM "https://yukicoder.me/problems/no/2119"
#include <bits/stdc++.h>
using namespace std;
struct fraction{
long long p, q; // long long or __int128_t
fraction(long long P = 0, long long Q = 1): p(P), q(Q){
normalize();
}
void normalize(){
long long g = __gcd(p, q);
p /= g, q /= g;
if(q < 0) p *= -1, q *= -1;
}
inline bool operator<(const fraction &other) const {
return p * other.q < other.p * q;
}
inline bool operator<=(const fraction &other) const {
return p * other.q <= other.p * q;
}
inline fraction operator+(const fraction &other) const { return fraction(p * other.q + q * other.p, q * other.q); }
inline fraction operator-(const fraction &other) const { return fraction(p * other.q - q * other.p, q * other.q); }
inline fraction operator*(const fraction &other) const { return fraction(p * other.p, q * other.q); }
inline fraction operator/(const fraction &other) const { return fraction(p * other.q, q * other.p); }
friend inline ostream& operator<<(ostream& os, const fraction& x) noexcept { return os << x.p << "/" << x.q; }
};
int main(){
long double x; cin >> x;
long long n = x * 100000000 + 1e-10;
fraction f = fraction(n, 100000000);
cout << f << endl;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0