From 5fc2b29cb5a6aa5b801086630a4e74b8a5f67720 Mon Sep 17 00:00:00 2001 From: pavangole Date: Sun, 27 Feb 2022 16:04:56 +0530 Subject: [PATCH] Solved Problem Statement 1 --- .../Pavan_gameofcodes_Ps-1/Solution.java | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Problem Statement-1/Solution/Pavan_gameofcodes_Ps-1/Solution.java diff --git a/Problem Statement-1/Solution/Pavan_gameofcodes_Ps-1/Solution.java b/Problem Statement-1/Solution/Pavan_gameofcodes_Ps-1/Solution.java new file mode 100644 index 0000000..b2ce715 --- /dev/null +++ b/Problem Statement-1/Solution/Pavan_gameofcodes_Ps-1/Solution.java @@ -0,0 +1,42 @@ +import java.util.Scanner; + + +public class Solution { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + + int nu_of_testcases = sc.nextInt(); + + while (nu_of_testcases != 0) { + int no_of_problems = sc.nextInt(); + int divisor_a = sc.nextInt(); + int divisor_b = sc.nextInt(); + int solvemininum = sc.nextInt(); + + int anvisolve = 0; + int problem = 1; + while (problem != no_of_problems) { + if (problem % divisor_a != 0 && problem % divisor_b != 0) { + if (problem % divisor_a == 0 && problem % divisor_b != 0) { + anvisolve++; + } + + if (problem % divisor_a != 0 && problem % divisor_b == 0) { + anvisolve++; + } + + } + + problem++; + } + nu_of_testcases--; + if(solvemininum >= anvisolve) { + System.out.println("Win"); + + } else { + System.out.println("Lose"); + + } + } + } +} \ No newline at end of file