結果

問題 No.396 クラス替え
ユーザー mban
提出日時 2017-01-09 23:19:38
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,707 bytes
コンパイル時間 769 ms
コンパイル使用メモリ 111,928 KB
実行使用メモリ 26,128 KB
最終ジャッジ日時 2024-12-18 00:20:38
合計ジャッジ時間 2,063 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17 WA * 3
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

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");
        }
    }
    static int Class(int num)
    {
        int q = (num + M - 1) / M;
        if (q % 2 == 0)
        {
            return M - (num % M)+1;
        }
        else
        {
            int res = num % M;
            if (res == 0)
            {
                return M;
            }
            else
            {
                return 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());
    }
}
0