結果
| 問題 |
No.1395 Less Sweet Alchemy
|
| コンテスト | |
| ユーザー |
bluemegane
|
| 提出日時 | 2021-04-19 18:50:46 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 25 ms / 2,000 ms |
| コード長 | 709 bytes |
| コンパイル時間 | 875 ms |
| コンパイル使用メモリ | 111,352 KB |
| 実行使用メモリ | 26,020 KB |
| 最終ジャッジ日時 | 2024-07-04 05:01:58 |
| 合計ジャッジ時間 | 1,878 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 12 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
public class Hello
{
static void Main()
{
string[] line = Console.ReadLine().Trim().Split(' ');
var n = int.Parse(line[0]);
var x = int.Parse(line[1]);
line = Console.ReadLine().Trim().Split(' ');
var a = Array.ConvertAll(line, int.Parse);
getAns(n, x, a);
}
static void getAns(int n, int x, int[] a)
{
var u = 0;
var e = 0;
var d = 0;
foreach(var w in a)
{
if (w > x) u++;
else if (w < x) d++;
else { Console.WriteLine("Yes"); return; }
}
if (u >= 1 && d >= 1) Console.WriteLine("Yes");
else Console.WriteLine("No");
}
}
bluemegane