結果
| 問題 |
No.668 6.0*10^23
|
| コンテスト | |
| ユーザー |
@abcde
|
| 提出日時 | 2019-06-09 12:14:05 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 761 bytes |
| コンパイル時間 | 1,572 ms |
| コンパイル使用メモリ | 168,580 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-02 03:56:46 |
| 合計ジャッジ時間 | 2,961 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 50 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
// 1. 入力情報取得.
string N;
cin >> N;
// 2. 小数第二位以下を四捨五入.
int i = stoi(N.substr(0, 2));
if(N[2] - '0' >= 5) i++;
// 3. 出力文字を編集.
int l = N.size();
string si = to_string(i);
// ex.
// i = 98 -> 99 ならば, i の 桁数増えてないが,
// i = 99 -> 100 ならば, i の 桁数が増えているので, l の デクリメントは行わない.
if(si.size() == 2) l--;
string ans = si.substr(0, 1) + "." + si.substr(1, 1) + "*10^" + to_string(l);
// 4. 後処理.
// ex.
// [入力値]
// 10545718176462
// -> 1.1*10^13
cout << ans << endl;
return 0;
}
@abcde