結果
| 問題 |
No.3286 Make a Happy Connection
|
| ユーザー |
pengin_2000
|
| 提出日時 | 2025-10-03 21:21:43 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 337 bytes |
| コンパイル時間 | 1,122 ms |
| コンパイル使用メモリ | 26,576 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-10-03 21:21:46 |
| 合計ジャッジ時間 | 2,023 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:6:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
6 | scanf("%d", &n);
| ^~~~~~~~~~~~~~~
main.c:9:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
9 | scanf("%d", &a[i]);
| ^~~~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h>
int a[502];
int main()
{
int n;
scanf("%d", &n);
int i;
for (i = 0; i < n; i++)
scanf("%d", &a[i]);
int cnt = 0;
for (i = 0; i < n - 1; i++)
if (a[i] == a[i + 1])
cnt++;
for (i = 1; i < n - 1; i++)
if (a[i - 1] == a[i + 1])
cnt++;
if (cnt > 0)
printf("Yes\n");
else
printf("No\n");
return 0;
}
pengin_2000