結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー TLwiegehtt
提出日時 2015-07-13 02:12:47
言語 C90
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 591 bytes
コンパイル時間 887 ms
コンパイル使用メモリ 20,864 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-13 13:28:00
合計ジャッジ時間 1,483 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21 WA * 25
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:11:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |         scanf("%d", &d);
      |         ^~~~~~~~~~~~~~~
main.c:13:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 |         scanf("%s", s);
      |         ^~~~~~~~~~~~~~
main.c:18:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   18 |         scanf("%s", s);
      |         ^~~~~~~~~~~~~~

ソースコード

diff #

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

int main(void){
	int i,d;
	int okMax = 0;
	
	char s[10];
	char week[30];
	
	scanf("%d", &d);
	
	scanf("%s", s);
	for(i=0;i<7;i++){
		week[i] = s[i];
	}
	
	scanf("%s", s);
	for(;i<15;i++){
		week[i] = s[i-7];
	}
	
	for(i=0;i<(14-d+1);i++){
		int ok=0;
		int j,rest = d;
		char tmp[30];
		strcpy(tmp, week);
		
		for(j=0;j<rest;j++){
			if(14 <= i+j){break;}
			tmp[i+j] = 'o';
		}
		for(j=0;j<15;j++){
			if(tmp[j] == 'o'){
				ok++;
			}else{
				if(okMax < ok ){
					okMax = ok;
				}
				ok = 0;
			}
		}
	}
	
	printf("%d\n", okMax);
	
	return 0;
}
0