結果

問題 No.816 Beautiful tuples
ユーザー solitarywalkersolitarywalker
提出日時 2019-05-13 00:11:31
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
実行時間 -
コード長 770 bytes
コンパイル時間 3,094 ms
コンパイル使用メモリ 106,792 KB
実行使用メモリ 26,448 KB
最終ジャッジ日時 2023-09-19 08:42:50
合計ジャッジ時間 8,461 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
26,448 KB
testcase_01 AC 61 ms
23,864 KB
testcase_02 AC 279 ms
21,852 KB
testcase_03 AC 1,409 ms
21,892 KB
testcase_04 AC 297 ms
21,952 KB
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;

public class Program
{
    public static void Main()
    {
        var pairs = Console.ReadLine().Split(' ').Select(s => ulong.Parse(s)).ToArray();
        ulong result = 0;
        var value = pairs[0] + pairs[1];
        for (ulong i = 1; i <= value; i++)
        {
            if (pairs[0] != pairs[1] && pairs[1] != i && i != pairs[0] && (pairs[0] + pairs[1]) % i == 0 && (i + pairs[0]) % pairs[1] == 0 && (i + pairs[1]) % pairs[0] == 0)
            {
                result = i;
                break;
            }
        }
        if (result != 0)
            Console.WriteLine(result);
        else
            Console.WriteLine("-1");
    }
}
0