Skip to content

Commit

Permalink
add LASER_BEAM
Browse files Browse the repository at this point in the history
  • Loading branch information
t3nsor committed Jul 25, 2016
1 parent d99a877 commit bd24c4f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions laser_beam.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// 2016-07-24
#include <cstdio>
int gcd(int x, int y) {
return x == 0 ? y : gcd(y%x, x);
}
int main() {
int T; scanf("%d", &T);
while (T--) {
int x, y;
scanf("%d %d", &x, &y);
printf("%d\n", 1 + gcd(x-1, y-1));
}
}

0 comments on commit bd24c4f

Please sign in to comment.