結果
| 問題 |
No.396 クラス替え
|
| コンテスト | |
| ユーザー |
りあん
|
| 提出日時 | 2016-07-14 13:55:04 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 28 ms / 1,000 ms |
| コード長 | 984 bytes |
| コンパイル時間 | 887 ms |
| コンパイル使用メモリ | 112,124 KB |
| 実行使用メモリ | 19,072 KB |
| 最終ジャッジ日時 | 2024-11-17 10:43:00 |
| 合計ジャッジ時間 | 2,243 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
class Program
{
static void Main()
{
var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
var s = Console.ReadLine();
if (s != s.Trim())
{
Console.WriteLine("unexpected spase");
return;
}
var a = s.Split().Select(int.Parse).ToArray();
var t = Console.ReadLine();
if (t != t.Trim())
{
Console.WriteLine("unexpected spase");
return;
}
var b = t.Split().Select(int.Parse).ToArray();
if (b[0] == b[1])
{
Console.WriteLine("unexpected input");
return;
}
sw.WriteLine(cls(a[1], b[0]) == cls(a[1], b[1]) ? "YES" : "NO");
sw.Flush();
}
static int cls(int m, int x)
{
int a = (x - 1) % (m * 2);
return a < m ? a + 1 : m * 2 - a;
}
}
りあん