結果

問題 No.396 クラス替え
ユーザー mbanmban
提出日時 2017-01-09 23:19:38
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,707 bytes
コンパイル時間 2,180 ms
コンパイル使用メモリ 104,752 KB
実行使用メモリ 22,880 KB
最終ジャッジ日時 2023-08-22 21:55:15
合計ジャッジ時間 5,299 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
20,724 KB
testcase_01 AC 57 ms
20,660 KB
testcase_02 AC 57 ms
22,696 KB
testcase_03 AC 57 ms
20,744 KB
testcase_04 AC 57 ms
20,868 KB
testcase_05 AC 59 ms
20,816 KB
testcase_06 AC 58 ms
22,700 KB
testcase_07 WA -
testcase_08 AC 57 ms
20,768 KB
testcase_09 WA -
testcase_10 AC 57 ms
22,712 KB
testcase_11 AC 57 ms
20,708 KB
testcase_12 AC 56 ms
20,908 KB
testcase_13 AC 56 ms
20,700 KB
testcase_14 AC 57 ms
20,804 KB
testcase_15 AC 56 ms
20,660 KB
testcase_16 AC 57 ms
20,800 KB
testcase_17 AC 57 ms
22,880 KB
testcase_18 WA -
testcase_19 AC 57 ms
20,748 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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