結果
| 問題 |
No.1070 Missing a space
|
| コンテスト | |
| ユーザー |
29da164
|
| 提出日時 | 2020-07-28 12:59:48 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 276 bytes |
| コンパイル時間 | 556 ms |
| コンパイル使用メモリ | 73,616 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-28 20:40:42 |
| 合計ジャッジ時間 | 937 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:14:15: warning: 'cnt' may be used uninitialized [-Wmaybe-uninitialized]
14 | cout << cnt-1 << endl;
| ^
main.cpp:9:7: note: 'cnt' was declared here
9 | int cnt;
| ^~~
ソースコード
#include <iostream>
#include <cmath>
#include <iomanip>
int main(void){
using namespace std;
std::string a;
std::cin >> a;
int cnt;
const char* ca = a.c_str();
for(int i=0;i<a.length();i++){
if(ca[i]!='0') cnt++;
}
cout << cnt-1 << endl;
return 0;
}
29da164