結果

問題 No.668 6.0*10^23
ユーザー agatan
提出日時 2018-03-23 22:56:39
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 451 bytes
コンパイル時間 652 ms
コンパイル使用メモリ 77,088 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-30 05:17:26
合計ジャッジ時間 6,218 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7 WA * 2 RE * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <functional>
#include <cmath>


using namespace std;

int main() {
    string s;
    cin >> s;
    double x = stod(s);
    int xlog10 = log10(x);
    double p = x / (pow(10, xlog10));
    if (p > 9.0) {
        p /= 10;
        xlog10++;
    } else if (p < 1.0) {
        p *= 10;
        xlog10--;
    }
    printf("%.1f*10^%d\n", p, xlog10);
}
0