結果

問題 No.1464 Number Conversion
ユーザー arashinarashin
提出日時 2021-04-02 23:42:08
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 651 bytes
コンパイル時間 1,679 ms
コンパイル使用メモリ 168,068 KB
実行使用メモリ 4,388 KB
最終ジャッジ日時 2023-08-25 14:18:42
合計ジャッジ時間 3,137 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using u64 = uint_least64_t;
using s64 = int_least64_t;
using ll = uint_least64_t;

int main(){
	string xs, us, ds;
	cin >> xs;
    int pos = xs.find(".");
    // cout << pos << endl;
    if (pos < 0){
        cout << xs << "/1" << endl;
        return 0;
    }
    us = xs.substr(0, pos);
    ds = xs.substr(pos + 1, xs.length() - pos-1);
    string ts = us + ds;
    u64 tsi = atoi(ts.c_str());
    u64 b = pow(10, ds.length());
    if (tsi % 2 == 0){
        tsi /= tsi;
        b /= 2;
    }
    if (tsi % 5 == 0){
        tsi /= tsi;
        b /= 5;
    }

	cout << tsi << "/"<< b << endl;
	return 0;
}
0