diff --git a/Codechef/LTIME95B/Array Rotation.java b/Codechef/LTIME95B/Array Rotation.java new file mode 100644 index 0000000..68101ec --- /dev/null +++ b/Codechef/LTIME95B/Array Rotation.java @@ -0,0 +1,86 @@ +import java.util.*; +import java.lang.*; +import java.io.*; + +class Codechef +{ + static class FastReader + { + BufferedReader br; + StringTokenizer st; + + public FastReader() + { + br = new BufferedReader(new + InputStreamReader(System.in)); + } + + String next() + { + while (st == null || !st.hasMoreElements()) + { + try + { + st = new StringTokenizer(br.readLine()); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + return st.nextToken(); + } + + int nextInt() + { + return Integer.parseInt(next()); + } + + + long nextLong() + { + return Long.parseLong(next()); + } + + double nextDouble() + { + return Double.parseDouble(next()); + } + + String nextLine() + { + String str = ""; + try + { + str = br.readLine(); + } + catch (IOException e) + { + e.printStackTrace(); + } + return str; + } + } + public static void main(String[] args) throws java.lang.Exception{ + FastReader sc=new FastReader(); + int n=sc.nextInt(); + long[] arr=new long[n]; + long sum=0; + for(int i=0;i0) { + int n=sc.nextInt(); + long w=sc.nextLong(); + long wr=sc.nextLong(); + long[] wt=new long[n]; + Hashtable d= new Hashtable<>(); + long temp; + for(int i=0;i=2) { + if(temp2%2==0) { + resw=resw+temp*temp2; + } + else { + resw=resw+temp*(temp2-1); + } + } + } + if(resw+wr>=w) { + System.out.print("YES\n"); + } + else { + System.out.print("NO\n"); + } + } + } +} diff --git a/Codechef/LTIME95B/Chef in Heaven.java b/Codechef/LTIME95B/Chef in Heaven.java new file mode 100644 index 0000000..82b7942 --- /dev/null +++ b/Codechef/LTIME95B/Chef in Heaven.java @@ -0,0 +1,92 @@ +import java.util.*; +import java.lang.*; +import java.io.*; + +class Codechef +{ + static class FastReader + { + BufferedReader br; + StringTokenizer st; + + public FastReader() + { + br = new BufferedReader(new + InputStreamReader(System.in)); + } + + String next() + { + while (st == null || !st.hasMoreElements()) + { + try + { + st = new StringTokenizer(br.readLine()); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + return st.nextToken(); + } + + int nextInt() + { + return Integer.parseInt(next()); + } + + + long nextLong() + { + return Long.parseLong(next()); + } + + double nextDouble() + { + return Double.parseDouble(next()); + } + + String nextLine() + { + String str = ""; + try + { + str = br.readLine(); + } + catch (IOException e) + { + e.printStackTrace(); + } + return str; + } + } + public static void main(String[] args) throws java.lang.Exception{ + FastReader sc=new FastReader(); + int t=sc.nextInt(); + while(t-->0) { + int l=sc.nextInt(); + String s=sc.next(); + int ones=0,zero=0; + int flag=0; + for(int i=0;i=zero) { + flag=1; + break; + } + } + if(flag==1) { + System.out.print("YES\n"); + } + else { + System.out.print("NO\n"); + } + } + } +}