ZeroJudge: a024 最大公因數 (GCD) Jul 30, 2016 • Jun 2, 2018 • WillyPillow • en, zh, bilingual, zerojudge, c, competitive-coding • Signature 用 輾轉相除法。 Use the Euclidean algorithm.ZeroJudge Link (Zh)#include <stdio.h> main() { int a, b; while (scanf("%d %d", &a, &b) != EOF) { while (b != 0) { if (a < b) { a ^= b; b ^= a; a ^= b; } a -= b; } printf("%d\n", a); } return 0; } Related Posts ZeroJudge: d049 中華民國萬歲! ZeroJudge: a095 麥哲倫的陰謀 ZeroJudge: a053 Sagit's 計分程式 ZeroJudge: a042 平面圖形切割 ZeroJudge: a040 阿姆斯壯數 0 commentsPost a comment Send an email to comment@nerde.pw.