結果
| 問題 |
No.116 門松列(1)
|
| ユーザー |
|
| 提出日時 | 2017-09-24 17:15:11 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 381 bytes |
| コンパイル時間 | 225 ms |
| コンパイル使用メモリ | 30,720 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-14 07:12:29 |
| 合計ジャッジ時間 | 1,086 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 4 WA * 17 |
コンパイルメッセージ
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]);
| ~~~~~^~~~~~~~~~~~~
ソースコード
#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;
}