|  | 
|  | 
| back to board | Can't find tests to prove algorithm wrong (WA 3) Posted by Kirill  26 Jan 2017 03:27I wrote simple implementation but can't figure out test to prove my solution wrong.
 4 3 -> 4
 3 3 -> 2
 4 5 -> 6
 4 6 -> 7
 3 8 -> 8
 6 5 -> 8
 6 8 -> 10
 
 #include "stdio.h"
 #include <stdlib.h>
 
 int main(void) {
 int bigger, lesser, a, b;
 scanf("%d", &a);
 scanf("%d", &b);
 if (a >= b) {
 bigger = a - 1; lesser = b - 1;
 } else {
 bigger = b - 1; lesser = a - 1;
 }
 
 if (bigger % lesser == 0) {
 printf("%d\n", bigger); return 0;
 }
 
 printf("%d\n", bigger + lesser - 1);
 
 return 0;
 }
 
Re: Can't find tests to prove algorithm wrong (WA 3) Posted by Kirill  26 Jan 2017 16:03Found it7 11  -> 14
 13 21 -> 16
 GCD is the key ;-)
Re: Can't find tests to prove algorithm wrong (WA 3) Posted by Ctalk3r  31 Oct 2017 01:0013 21 -> 28 | 
 | 
|