結果

問題 No.116 門松列(1)
ユーザー mafuyu-akimafuyu-aki
提出日時 2017-09-24 17:15:11
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 381 bytes
コンパイル時間 399 ms
コンパイル使用メモリ 30,848 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-26 17:36:01
合計ジャッジ時間 1,123 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 0 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 0 ms
5,376 KB
testcase_08 WA -
testcase_09 AC 1 ms
5,376 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 1 ms
5,376 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main(int, char**)’:
main.cpp:12:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |         scanf("%d", &N);
      |         ~~~~~^~~~~~~~~~
main.cpp:18:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   18 |                 scanf("%c", &A[j]);
      |                 ~~~~~^~~~~~~~~~~~~

ソースコード

diff #

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



int main(int argc, char *argv[])
{

	int N = 0;
	scanf("%d", &N);

	char A[100] = "";

	for (int j = 0; j < N; j++)
	{
		scanf("%c", &A[j]);
	}


	int lSum = 0;
	for (int i = 0; i < (N - 2); i++)
	{
		if (A[i] < A[i + 1] &&
			A[i + 2] < A[i + 1])
			lSum++;
	}
	printf("%d\n", lSum);

	return 0;

}

0