結果
問題 | No.1464 Number Conversion |
ユーザー |
![]() |
提出日時 | 2021-04-04 02:32:00 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 895 bytes |
コンパイル時間 | 1,008 ms |
コンパイル使用メモリ | 93,552 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-26 01:00:33 |
合計ジャッジ時間 | 2,258 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 29 |
ソースコード
/* -*- coding: utf-8 -*- * * 1464.cc: No.1464 Number Conversion - yukicoder */ #include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<iostream> #include<string> #include<vector> #include<map> #include<set> #include<stack> #include<list> #include<queue> #include<deque> #include<algorithm> #include<numeric> #include<utility> #include<complex> #include<functional> using namespace std; /* constant */ /* typedef */ typedef long long ll; /* global variables */ char s[64]; /* subroutines */ /* main */ int main() { scanf("%s", s); ll n = 0, d = 1; bool f = false; for (int i = 0; s[i]; i++) { if (s[i] == '.') f = true; else { n = n * 10 + (s[i] - '0'); if (f) d *= 10; } } while (n % 2 == 0 && d % 2 == 0) n /= 2, d /= 2; while (n % 5 == 0 && d % 5 == 0) n /= 5, d /= 5; printf("%lld/%lld\n", n, d); return 0; }