結果

問題 No.345 最小チワワ問題
ユーザー yamaken1343yamaken1343
提出日時 2016-06-02 21:55:52
言語 C90
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 337 bytes
コンパイル時間 251 ms
コンパイル使用メモリ 20,608 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-08 05:58:21
合計ジャッジ時間 1,509 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20 WA * 9
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:6:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |         scanf("%s",s);
      |         ^~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
int main(void){
	char s[101];
	int i, j, k, ans = 1000;
	char c;
	scanf("%s",s);
	for(i=0;i<101;i++){
		if(s[i] == 'c'){
			for(j=i+1;j<101;j++){
				if(s[j] == 'w'){
					for(k=j+1;k<101;k++){
						if(s[k] == 'w'){
							if(ans>(j-i)) ans = k-i+1;
	}}}}}}
	if(ans == 1000) ans = -1;
	printf("%d\n",ans);
	return 0;
}
0