結果
問題 |
No.816 Beautiful tuples
|
ユーザー |
|
提出日時 | 2019-05-12 23:36:16 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 774 bytes |
コンパイル時間 | 861 ms |
コンパイル使用メモリ | 112,868 KB |
実行使用メモリ | 30,644 KB |
最終ジャッジ日時 | 2024-07-05 19:21:16 |
合計ジャッジ時間 | 3,812 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 1 TLE * 1 -- * 13 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; public class Program { const ulong value = 1000000000000000000; public static void Main() { var pairs = Console.ReadLine().Split(' ').Select(s => ulong.Parse(s)).ToArray(); ulong result = 0; 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"); } }