結果
問題 | No.442 和と積 |
ユーザー | claw88 |
提出日時 | 2016-11-11 22:48:18 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 25 ms / 1,000 ms |
コード長 | 891 bytes |
コンパイル時間 | 2,794 ms |
コンパイル使用メモリ | 114,596 KB |
実行使用メモリ | 17,920 KB |
最終ジャッジ日時 | 2024-07-04 22:29:38 |
合計ジャッジ時間 | 2,126 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 |
コンパイルメッセージ
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; namespace yuki_442 { class Program { static void Main(string[] args) { var t = scan; var x = t[0]; var y = t[1]; var gcd1= gcd(x+y, x); var gcd2 = gcd((x + y) / gcd1, y); Console.WriteLine(gcd1 * gcd2); } static long gcd(long x, long y) { if (x > y) { long t = x; x = y; y = t; } while (y > 0) { long r = x % y; x = y; y = r; } return x; } static long[] scan { get { return Array.ConvertAll(Console.ReadLine().Split(), long.Parse); } } } }