結果

問題 No.1464 Number Conversion
ユーザー jebouinjebouin
提出日時 2021-04-02 21:44:14
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,374 bytes
コンパイル時間 1,564 ms
コンパイル使用メモリ 167,652 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-25 11:56:04
合計ジャッジ時間 33,985 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = (a); i <= (b); i++)
#define rng(a) a.begin(), a.end()
#define ina(n,a) cin >> n; for(int i = 1; i <= n; i++) cin >> a[i]
#define sz(x) (int)(x).size()
#define se second
#define fi first
#define prev            coyhhhhhhyoc    
#define next          sdNNNmNNNNNNNmds  
#define y0           hNNNNy_yNNNNNN_sNh
#define y1          mNNNNNdtdNNNNNNtsNNm
#define yn          mNNNNNNNNy___smNNNms
#define tm            oooooosyysooooot 
#define read               tyhyt        
#define rank              ytmNmo         
#define index              yyy
#define pb push_back
#define pcnt __builtin_popcountll
#define rrep(i,a,b) for(int i = (b); i >= (a); i--)
#define rall(x,a) for(auto x : a)
#define MOD 1000000007
#define endl "\n"
#define int long long
typedef long long ll;
using namespace std;

const int M = 1e16;

int solve() {
    double dx, md = 10;
    cin >> dx;
    string ans;
    for(int d = 1; d * d <= M; d++) {
        if(M % d) continue;
        int x = round(d * dx);
        double dist = abs(d * dx - x);
        if(dist < md) {
            md = dist;
            ans = to_string(x) + "/" + to_string(d);
        }
    }
    cout << ans << endl;
    return 0;
}
 
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t = 1;
    while(t--) {
        solve();
    }
    return 0;
}
0