結果
| 問題 |
No.436 ccw
|
| コンテスト | |
| ユーザー |
いろどり
|
| 提出日時 | 2017-03-01 19:01:56 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 339 bytes |
| コンパイル時間 | 396 ms |
| コンパイル使用メモリ | 54,396 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-12 22:18:21 |
| 合計ジャッジ時間 | 1,272 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 24 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:11:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
11 | scanf("%s", s);
| ~~~~~^~~~~~~~~
ソースコード
// ccw
#include <iostream>
#include <cstdio>
using namespace std;
char s[100005] = {};
int count_c, count_w;
int main() {
int i = 0;
scanf("%s", s);
while(i < 100000) {
if(s[i] == 'c') count_c++;
else if(s[i] == 'w') count_w++;
i++;
}
cout << min(count_c - 1, count_w) << endl;
return 0;
}
いろどり