結果
問題 |
No.396 クラス替え
|
ユーザー |
![]() |
提出日時 | 2017-01-09 23:37:45 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 27 ms / 1,000 ms |
コード長 | 1,688 bytes |
コンパイル時間 | 946 ms |
コンパイル使用メモリ | 109,740 KB |
実行使用メモリ | 25,948 KB |
最終ジャッジ日時 | 2024-12-18 00:20:40 |
合計ジャッジ時間 | 1,962 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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; using System.Collections.Generic; using System.Collections.Specialized; using System.Text; using System.Text.RegularExpressions; using System.Linq; class Magatro { static Scanner sc = new Scanner(); static int N, M, X, Y; static void Main() { N = sc.NextInt(); M = sc.NextInt(); X = sc.NextInt(); Y = sc.NextInt(); if (Class(X) == Class(Y)) { Console.WriteLine("YES"); } else { Console.WriteLine("NO"); } // Console.WriteLine("{0} {1}", Class(X), Class(Y)); } static int Class(int num) { int q = (num - 1) / M; if (q % 2 == 0) { int res = (num - 1) % M; res++; return res; } else { int res = (num - 1) % M; return M - res; } } } public class Scanner { private string[] S; private int Index; private char Separator; public Scanner(char separator=' ') { Index = 0; Separator = separator; } public string Next() { string result; if (S == null || Index >= S.Length) { S = Line(); Index = 0; } result = S[Index]; Index++; return result; } private string[] Line() { return Console.ReadLine().Split(Separator); } public int NextInt() { return int.Parse(Next()); } public double NextDouble() { return double.Parse(Next()); } public long NextLong() { return long.Parse(Next()); } }