結果

問題 No.203 ゴールデン・ウィーク(1)
ユーザー hum_op
提出日時 2015-05-08 22:56:29
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 336 bytes
コンパイル時間 105 ms
コンパイル使用メモリ 22,784 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-18 09:04:01
合計ジャッジ時間 838 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 29
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:12:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |         scanf("%s", &day[0]);
      |         ~~~~~^~~~~~~~~~~~~~~
main.cpp:13:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 |         scanf("%s", &day[7]);
      |         ~~~~~^~~~~~~~~~~~~~~

ソースコード

diff #

#include <cstdio>

int max(int a, int b){
	return a > b ? a : b;
}


int main(){
	char day[15];
	int count = 0;
	int ans = -1;
	scanf("%s", &day[0]);
	scanf("%s", &day[7]);

	for (int i = 0; i < 15; i++){
		if (day[i] == 'o') {
			count++;
		}
		else {
			ans = max(ans, count);
			count = 0;
		}
	}

	printf("%d\n", ans);

	return 0;
}
0