1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | using System; public class Program { public static bool IsGoodDivision(int a, int b) { while (b % 2 == 0) { b /= 2; } while (b % 5 == 0) { b /= 5; } return a % b == 0; } public static void Test(int a, int b) { Console.WriteLine("{0}/{1} {2} good.", a, b, IsGoodDivision(a, b) ? "is" : "is not"); } public static void Main() { Test(1, 4); Test(1, 8); Test(47, 183); Test(58, 889); Test(1, 5); } } |
-
upload with new input
-
result: Success time: 0.03s memory: 33904 kB returned value: 0
5
1/4 is good. 1/8 is good. 47/183 is not good. 58/889 is not good. 1/5 is good.
-
result: Success time: 0.03s memory: 33944 kB returned value: 0
24
1/4 is good. 1/8 is good. 47/183 is not good. 58/889 is not good. 1/5 is good.
-
result: Success time: 0.03s memory: 36968 kB returned value: 0
1
1/4 is good. 1/8 is good. 47/183 is not good. 58/889 is not good. 1/5 is good.
-
result: Success time: 0.04s memory: 37016 kB returned value: 0
using System; public class Program { public static bool IsGoodDivision(int a, int b) { while (b % 2 == 0) { b /= 2; } while (b % 5 == 0) { b /= 5; } return a % b == 0; } public static void Test(int a, int b) { Console.WriteLine("{0}/{1} {2} good.", a, b, IsGoodDivision(a, b) ? "is" : "is not"); } public static void Main() { Test(1, 4); Test(1, 8); Test(47, 183); Test(58, 889); Test(1, 5); Test(1, 10); } }1/4 is good. 1/8 is good. 47/183 is not good. 58/889 is not good. 1/5 is good.
-
result: Success time: 0.03s memory: 36968 kB returned value: 0
1/4 is good. 1/8 is good. 47/183 is not good. 58/889 is not good. 1/5 is good.


