結果
問題 |
No.1464 Number Conversion
|
ユーザー |
![]() |
提出日時 | 2021-04-02 23:42:08 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 651 bytes |
コンパイル時間 | 2,249 ms |
コンパイル使用メモリ | 168,624 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-23 22:43:12 |
合計ジャッジ時間 | 2,936 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 14 WA * 15 |
ソースコード
#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; }