結果

問題 No.436 ccw
ユーザー ichiruisyu
提出日時 2016-11-02 15:35:58
言語 C90
(gcc 12.3.0)
結果
RE  
実行時間 -
コード長 333 bytes
コンパイル時間 399 ms
コンパイル使用メモリ 20,864 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-25 01:29:52
合計ジャッジ時間 5,014 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 2
other RE * 24
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:11:25: warning: format ‘%c’ expects argument of type ‘char *’, but argument 2 has type ‘int’ [-Wformat=]
   11 |                 scanf("%c", S[i]);
      |                        ~^   ~~~~
      |                         |    |
      |                         |    int
      |                         char *
main.c:11:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |                 scanf("%c", S[i]);
      |                 ^~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <string.h>


int main()
{
	int i, c_count, w_count;
	char S[100003];
	
	for(i=0; ;i++){
		scanf("%c", S[i]);
		if(S[i] == 'w')
			c_count = i;
		if(S[i] == '\n'){
			w_count = i-c_count-1;
			break;
		}
	}
	
	if(c_count+1 > w_count)
		printf("%d",w_count);
	else
		printf("%d",c_count-1);
		
	return 0;
}
0