結果
問題 |
No.204 ゴールデン・ウィーク(2)
|
ユーザー |
![]() |
提出日時 | 2015-07-13 02:29:15 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 1,000 ms |
コード長 | 761 bytes |
コンパイル時間 | 1,077 ms |
コンパイル使用メモリ | 21,376 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-24 11:48:23 |
合計ジャッジ時間 | 2,120 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 46 |
コンパイルメッセージ
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:17:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 17 | scanf("%s", s); | ^~~~~~~~~~~~~~ main.c:21:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 21 | scanf("%s", s); | ^~~~~~~~~~~~~~
ソースコード
#include <stdio.h> #include <string.h> int main(void){ int i,d; int okMax = 0; char s[10]; char week[60]; scanf("%d", &d); for(i=0;i<d;i++){ week[i] = 'x'; } scanf("%s", s); for(i=d;i<(d+7);i++){ week[i] = s[i-d]; } scanf("%s", s); for(i=(d+7);i<(d+14);i++){ week[i] = s[i-(d+7)]; } for(i=(d+14);i<(d+d+14);i++){ week[i] = 'x'; week[i+1] = '\0'; } for(i=0;i<(d+14+1);i++){ int ok=0; int j,rest = d; char tmp[60]={0}; strcpy(tmp, week); for(j=0;j<rest;j++){ if(tmp[i+j] =='o'){break;} tmp[i+j] = 'o'; } for(j=0;;j++){ if(tmp[j] == 'o'){ ok++; }else{ if(okMax < ok ){ okMax = ok; } ok = 0; } if(tmp[j] == '\0'){break;} } } printf("%d\n", okMax); return 0; }