結果

問題 No.442 和と積
ユーザー mban
提出日時 2016-11-11 23:51:42
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 787 bytes
コンパイル時間 816 ms
コンパイル使用メモリ 105,864 KB
実行使用メモリ 26,928 KB
最終ジャッジ日時 2024-11-25 09:58:02
合計ジャッジ時間 2,292 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13 WA * 5
権限があれば一括ダウンロードができます
コンパイルメッセージ
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()
    {
        string[] q = Console.ReadLine().Split(' ');
        Array.Sort(q);
        long A = long.Parse(q[0]);
        long B = long.Parse(q[1]);
        long GG = G(B, A);
        long aa = A / GG;
        long bb = B / GG;
        if (A == B)
        {
            if (A % 2 == 0)
            {
                Console.WriteLine(2 * A);
                return;
            }
        }
        Console.WriteLine(GG);
        
    }
    static long G(long a,long b)
    {
        long r = a % b;
        while (r != 0)
        {
            a = b;
            b = r;
            r = a % b;
        }
        return b;
    }
}
0