結果

問題 No.668 6.0*10^23
ユーザー ku_material_ro
提出日時 2018-05-18 01:39:31
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 580 bytes
コンパイル時間 618 ms
コンパイル使用メモリ 73,444 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-30 07:01:48
合計ジャッジ時間 2,025 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 50
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include<stdio.h>
#include<algorithm>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define SZ(x) ((int)(x).size())

using namespace std;

int main(){
	string s;
	cin >> s;
	int k,a,b;
	k = SZ(s) - 1;
	a = s[0] - '0';
	b = s[1] - '0';

	if (s[2] - '0' >= 5) {
		b += 1;
		if (b == 10) {
			a += 1;
			b = 0;
			if (a == 10) {
				a = 1;
				k += 1;
			}
		}
	}
	cout << a << "." << b << "*10^" << k << endl;
	return 0;
}
0