結果
| 問題 |
No.116 門松列(1)
|
| ユーザー |
|
| 提出日時 | 2022-06-06 15:23:50 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 29 ms / 5,000 ms |
| コード長 | 1,087 bytes |
| コンパイル時間 | 972 ms |
| コンパイル使用メモリ | 104,064 KB |
| 実行使用メモリ | 18,304 KB |
| 最終ジャッジ日時 | 2024-09-21 04:39:20 |
| 合計ジャッジ時間 | 2,733 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
namespace yukicoder
{
class Program
{
static void Main(string[] args)
{
int a = int.Parse(Console.ReadLine());
string[] s = Console.ReadLine().Split(' ');
int[] b = new int[3];
int[] c = new int[3];
int k;
int count = 0;
for(int i = 0; i <= a; i++)
{
if (i + 2 >= a)
{
break;
}
b[0] = int.Parse(s[i]);
b[1] = int.Parse(s[i + 1]);
b[2] = int.Parse(s[i+2]);
for(int j = 0; j < 3; j++)
{
c[j]=b[j];
}
Array.Sort(c);
k=c[1];
if (k == b[0] || k == b[2])
{
if (b[0]!=b[1]&&b[0]!=b[2]&&b[1]!=b[2])
{
count++;
}
}
}
Console.WriteLine(count);
}
}
}