結果

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

ソースコード

diff #

#include <iostream>
#include <string>
#include <string.h>
using namespace std;
int main(int argc, char* argv[])
{
	string s;
	cin>>s;
	int len=s.length();
	if (len==1){
		cout<<s[0]<<"*"<<"10^0"<<endl;
		return 0;
	}else if (len==2){
		cout<<"s[0]"<<"."<<"s[1]"<<"*10^1"<<endl;
		return 0;
	}
	char n[10];
	int N;
	strncpy(n,s.c_str(),3);
	N=atol(n);
	int num=len-3;
	N=int((float)N/10.0+0.5)*10;
	sprintf(n,"%d",N);
	cout<<n[0]<<"."<<n[1]<<"*10^"<<num+strlen(n)-1<<endl;
	return 0;
}
0