結果

問題 No.358 も~っと!門松列
ユーザー mban
提出日時 2016-11-04 12:44:10
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 30 ms / 1,000 ms
コード長 1,023 bytes
コンパイル時間 872 ms
コンパイル使用メモリ 112,600 KB
実行使用メモリ 29,196 KB
最終ジャッジ日時 2024-11-25 02:35:21
合計ジャッジ時間 2,350 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Magatro
{
    static void Main()
    {
        int[] A = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        if (A[0] == A[1] || A[0] == A[2]||A[1]==A[2])
        {
            Console.WriteLine(0);
            return;
        }
        if (A.Min() == A[1]||A.Max()==A[1])
        {
            Console.WriteLine("INF");
            return;
        }
        int max = A.Max();
        int cnt = 0;
        for(int i = 3; i <= max; i++)
        {
            if (Kadomatsu(A[0] % i, A[1] % i, A[2] % i))
            {
                cnt++;
            } 
        }
        Console.WriteLine(cnt);
    }
   static bool Kadomatsu(params int[] A)
    {
        if(A[0] == A[1] || A[0] == A[2] || A[1] == A[2])
        {
            return false;
        }
        if (A.Min() == A[1] || A.Max() == A[1])
        {
            return true;
        }
        return false;
    }

}
0