結果

問題 No.668 6.0*10^23
ユーザー AnzySou
提出日時 2018-03-23 23:54:05
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 549 bytes
コンパイル時間 952 ms
コンパイル使用メモリ 68,268 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-30 05:27:29
合計ジャッジ時間 2,039 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 50
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
using namespace std;

string S;

int main(){
   cin >> S;
   
   bool flag=false;
   if(S[2]>='5'){
      if(S[1]=='9'){
         S[1]='0';
         if(S[0]=='9'){
            S[0]='1'; flag=true;
         }
         else S[0]++;
      }
      else S[1]++;
   }

   string t="";
   t+=S[0];
   t+='.';
   t+=S[1];
   t+="*10^";
   
   int n;
   if(flag){
      n=S.size();
   } else{
      n=S.size()-1;
   }
   t+=to_string(n);

   cout << t << endl;
}
0