結果
問題 |
No.442 和と積
|
ユーザー |
![]() |
提出日時 | 2016-11-11 23:47:06 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 645 bytes |
コンパイル時間 | 1,764 ms |
コンパイル使用メモリ | 114,888 KB |
実行使用メモリ | 26,916 KB |
最終ジャッジ日時 | 2024-11-25 09:52:08 |
合計ジャッジ時間 | 3,031 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 WA * 8 |
コンパイルメッセージ
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; 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; Console.WriteLine(G(aa + bb, aa * bb)*GG); } static long G(long a,long b) { long r = a % b; while (r != 0) { a = b; b = r; r = a % b; } return b; } }