From fef902d6298b2efb7f6392e740b307e86d17b625 Mon Sep 17 00:00:00 2001 From: Astel Thottankara <57724542+astonizer@users.noreply.github.com> Date: Thu, 1 Oct 2020 08:39:25 +0530 Subject: [PATCH 1/2] Java solution for gcd operations --- CodeChef/LTIME88B/astonizer/gcdops.java | 36 +++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 CodeChef/LTIME88B/astonizer/gcdops.java diff --git a/CodeChef/LTIME88B/astonizer/gcdops.java b/CodeChef/LTIME88B/astonizer/gcdops.java new file mode 100644 index 0000000..c78a6aa --- /dev/null +++ b/CodeChef/LTIME88B/astonizer/gcdops.java @@ -0,0 +1,36 @@ +/* package codechef; // don't place package name! */ + +import java.util.*; +import java.lang.*; +import java.io.*; + +/* Name of the class has to be "Main" only if the class is public. */ +class Codechef +{ + public static void main (String[] args) throws java.lang.Exception + { + Scanner sc = new Scanner(System.in); + PrintWriter pw = new PrintWriter(System.out); + int t = sc.nextInt(); + while (t-- > 0) { + int n = sc.nextInt(); + int[] b = new int[n]; + boolean check = false; + for (int i = 0; i < n; i++) { + b[i] = sc.nextInt(); + } + for (int i = 0; i < n; i++) { + if ((i+1) % b[i] != 0) { + check = true; + break; + } + } + if(!check) { + pw.println("YES"); + } else { + pw.println("NO"); + } + } + pw.flush(); + } +} From 13dc245a761296e412902ae2313949378fad755a Mon Sep 17 00:00:00 2001 From: Astel Thottankara <57724542+astonizer@users.noreply.github.com> Date: Thu, 1 Oct 2020 08:44:53 +0530 Subject: [PATCH 2/2] Java solution for watermelon --- CodeChef/LTIME88B/astonizer/watmelon.java | 36 +++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 CodeChef/LTIME88B/astonizer/watmelon.java diff --git a/CodeChef/LTIME88B/astonizer/watmelon.java b/CodeChef/LTIME88B/astonizer/watmelon.java new file mode 100644 index 0000000..3ad89a3 --- /dev/null +++ b/CodeChef/LTIME88B/astonizer/watmelon.java @@ -0,0 +1,36 @@ +/* package codechef; // don't place package name! */ + +import java.util.*; +import java.lang.*; +import java.io.*; + +/* Name of the class has to be "Main" only if the class is public. */ +class Codechef +{ + public static void main (String[] args) throws java.lang.Exception + { + Scanner sc = new Scanner(System.in); + PrintWriter pw = new PrintWriter(System.out); + int t = sc.nextInt(); + while(t-- > 0) { + int n = sc.nextInt(); + int[] arr = new int[n]; + int flag = 0; + for(int i = 0; i < n; i++) { + arr[i] = sc.nextInt(); + } + + int sum = 0; + for(int i = 0; i < n; i++) { + sum += arr[i]; + } + + if(sum < 0) { + System.out.println("NO"); + } else { + System.out.println("YES"); + } + } + pw.flush(); + } +}