結果

問題 No.1464 Number Conversion
ユーザー jutamajutama
提出日時 2021-04-16 00:46:51
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,606 bytes
コンパイル時間 3,254 ms
コンパイル使用メモリ 161,916 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-15 03:05:48
合計ジャッジ時間 5,926 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 AC 1 ms
4,380 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <atcoder/all>
#include <bitset>
#include <fstream>
#include <functional>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
using namespace atcoder;

//* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *//

void input() {
    
    
}

long long gcd(long long a, long long b) {if(b==0){return(a);} else{return(gcd(b, a%b));}}

std::pair<long long, long long> input_deci(int d) {
    assert(d >= 0);
    std::string r; std::cin >> r;
    std::string::size_type rs = r.size();
    std::string::size_type rp = r.find('.');
    long long r_inte = std::stoll(r.substr(0, rp));
    long long r_frac = (rp == std::string::npos) ? 0 : std::stoll(r.substr(rp+1));
    if(!(rp == std::string::npos)) while(d-- >= (int)(rs-rp)) { r_frac *= 10; }
    return {r_inte, r_frac};
}

long long input_deci_ll(int d) {
    std::pair<long long, long long> deci = input_deci(d);
    while(d--) { deci.first *= 10; }
    return deci.first + deci.second;
}

void solve() {
    
    
    long long Xs = input_deci_ll(8);
    long long Xb = (long long)pow(10, 8);
    long long Xgcd = gcd(Xs, Xb);
    
    Xs /= Xgcd;
    Xb /= Xgcd;
    cout << Xs << '/' << Xb << endl;
    
    
    
    
    
}

//* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *//

int main() {
    
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
    std::cin.tie(0);
    ios::sync_with_stdio(false);
    
    input();
    solve();
    
    return 0;
}
0