結果
| 問題 | No.442 和と積 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2023-07-28 14:50:02 | 
| 言語 | C# (.NET 8.0.404) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 578 bytes | 
| コンパイル時間 | 10,708 ms | 
| コンパイル使用メモリ | 167,700 KB | 
| 実行使用メモリ | 186,060 KB | 
| 最終ジャッジ日時 | 2024-10-06 06:17:09 | 
| 合計ジャッジ時間 | 12,874 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 WA * 1 | 
| other | AC * 12 WA * 6 | 
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (93 ms)。 MSBuild のバージョン 17.9.6+a4ecab324 (.NET) main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
using System;
using System.Collections.Generic;
using System.Linq;
namespace yukicoder
{
	public class Program
	{
		public static void Main()
		{
			var a = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
			var k = Euclid(a[0] , a[1]);
            if ((a[0] / k + a[1] / k) % 2 == 0)
            {
				k *= 2;
            }
			Console.WriteLine(k);
		}
		static long Euclid(long a, long b)
		{
			var c = Math.Max(a, b);
			var d = Math.Min(a, b);
			var e = c % d;
			if (e > 0)
			{
				return Euclid(e, d);
			}
			else
			{
				return d;
			}
		}
	}
}
            
            
            
        