結果

問題 No.442 和と積
コンテスト
ユーザー むらため
提出日時 2019-01-18 18:40:48
言語 Nim
(2.2.8)
コンパイル:
nim --nimcache=~ --hints:off -o:a.out -d:release cpp _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 492 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,619 ms
コンパイル使用メモリ 68,232 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2026-03-22 08:39:58
合計ジャッジ時間 2,508 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import math
proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "<stdio.h>" .}
proc scan(): int =
  while true:
    var k = getchar_unlocked()
    if k < '0' or k > '9': break
    else: result = 10 * result + k.ord - '0'.ord

# 15 35 => 50 15*35
# 5*(3 7 => 10 21)
# 6 10 => 2*(3 5) => 2*(8 15*2)
#      => 16 60
# 60 100 => 20*(3 5) => 160 6000 => 8 30
let a = scan()
let b = scan()
let g = a.gcd(b)
if g mod 2 == 0  and (a div g + b div g) mod 2 == 0: echo g * 2
else:echo g
0