結果
問題 | No.1464 Number Conversion |
ユーザー |
![]() |
提出日時 | 2022-05-28 11:56:02 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 476 bytes |
コンパイル時間 | 3,260 ms |
コンパイル使用メモリ | 244,708 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-20 21:02:07 |
合計ジャッジ時間 | 3,785 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 29 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define int long long #define double long double signed main(){ string N; cin>>N; int bunshi = 0; int bunbo = 1; bool dot = false; for(int i=0;i<N.size();i++){ if(N[i] == '.'){ dot = true; continue; } else{ bunshi *= 10; bunshi += (N[i]-'0'); } if(dot) bunbo *= 10; } int a=bunshi;int b=bunbo; cout<<bunshi/gcd(a,b)<<'/'<<bunbo/gcd(a,b)<<endl; }