結果
問題 |
No.688 E869120 and Constructing Array 2
|
ユーザー |
|
提出日時 | 2018-06-24 15:32:53 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 346 bytes |
コンパイル時間 | 1,061 ms |
コンパイル使用メモリ | 158,016 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-07 14:21:00 |
合計ジャッジ時間 | 3,631 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 3 |
other | WA * 8 RE * 2 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:11:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wformat=] 11 | printf("1.0*10^%d\n",sNum.size()); | ~^ ~~~~~~~~~~~ | | | | int std::__cxx11::basic_string<char>::size_type {aka long unsigned int} | %ld main.cpp:13:22: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wformat=] 13 | printf("%.1f*10^%d\n",(float)a/10,sNum.size() -1); | ~^ ~~~~~~~~~~~~~~ | | | | int std::__cxx11::basic_string<char>::size_type {aka long unsigned int} | %ld
ソースコード
#include<stdio.h> #include<bits/stdc++.h> using namespace std; int main(){ string sNum; cin >> sNum; assert(sNum.size() >= 3); int a = (sNum[0] - '0')*10 + (sNum[1] - '0'); if((sNum[2] - '0')>=5)a++; if(a >= 100){ printf("1.0*10^%d\n",sNum.size()); }else{ printf("%.1f*10^%d\n",(float)a/10,sNum.size() -1); } return 0; }