結果
| 問題 | No.1464 Number Conversion |
| コンテスト | |
| ユーザー |
arashin
|
| 提出日時 | 2021-04-02 23:53:14 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 963 bytes |
| 記録 | |
| コンパイル時間 | 1,618 ms |
| コンパイル使用メモリ | 169,288 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-23 22:59:28 |
| 合計ジャッジ時間 | 2,483 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 23 WA * 6 |
ソースコード
#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);
// cout << "us=" << us << endl;
ds = xs.substr(pos + 1, xs.length() - pos-1);
// cout << "ds=" << ds << endl;
string ts = us + ds;
// cout << "ts=" << ts << endl;
u64 tsi = atoi(ts.c_str());
if (tsi == 0){
cout << "0/1" << endl;
return 0;
}
u64 b = pow(10, ds.length());
bool f = true;
while(f){
f = false;
if (tsi % 2 == 0){
tsi /= 2;
b /= 2;
f = true;
}
if (tsi % 5 == 0){
tsi /= 5;
b /= 5;
f = true;
}
}
cout << tsi << "/"<< b << endl;
return 0;
}
arashin