結果
| 問題 | No.1464 Number Conversion | 
| コンテスト | |
| ユーザー |  a01sa01to | 
| 提出日時 | 2025-08-01 00:19:10 | 
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 3 ms / 2,000 ms | 
| コード長 | 643 bytes | 
| コンパイル時間 | 3,288 ms | 
| コンパイル使用メモリ | 279,092 KB | 
| 実行使用メモリ | 7,720 KB | 
| 最終ジャッジ日時 | 2025-08-01 00:19:16 | 
| 合計ジャッジ時間 | 4,895 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 29 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using ull = unsigned long long;
inline ll pow10(ll a) {
  ll res = 1;
  while (a--) res *= 10;
  return res;
}
int main() {
  cin.tie(nullptr)->sync_with_stdio(false);
  string s;
  cin >> s;
  if (s.find('.') == string::npos) {
    cout << s << "/1" << '\n';
    return 0;
  }
  int pos = s.find('.');
  string a = s.substr(0, pos);
  string b = s.substr(pos + 1);
  ll x = stoll(a) * pow10(b.size()) + stoll(b);
  ll y = pow10(b.size());
  ll g = gcd(x, y);
  x /= g, y /= g;
  cout << x << '/' << y << '\n';
  return 0;
}
            
            
            
        