Posts

Showing posts from July, 2021

RecyclerItemClickListener.java

  package   com.student.counselling. U tilities ; import   android.content.Context ; import   android.support.v7.widget.RecyclerView ; import   android.view.GestureDetector ; import   android.view.MotionEvent ; import   android.view.View ; public   class   RecyclerItemClickListener   implements   RecyclerView.OnItemTouchListener  {      private   OnItemClickListener  mListener;      public   interface   OnItemClickListener  {          public   void   onItemClick ( View   view ,  int   position );          public   void   onLongItemClick ( View   view ,  int   position );     }      GestureDetector  mGestureDetector;      public   RecyclerItemClickListener ( Context   context ,  final   RecyclerView   recyclerView ,  OnItemClickListener   listener ) {         mListener  =  listener;         mGestureDetector  =   new   GestureDetector (context,  new  GestureDetector. SimpleOnGestureListener () {             @ Override              public   boolean   onSingleTapUp ( MotionEvent  e) {     

fast input out using buffer class

 /* package codechef; // don't place package name! */ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.lang.reflect.Array; import java.util.StringTokenizer; import java.util.Arrays; class judge_chef_contest {     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()         {  

Fast input output in java its amazing zing zing

  /* package codechef; // don't place package name! */ import java . util .*; import java . lang .*; import java . io .*; import java . math . BigInteger ; class Main { static List < Integer >[] edges ; static boolean [] vis ; static List < Integer > path ; public static void main ( String [] args ) throws java . lang . Exception { // your code goes here FastScanner in = new FastScanner (); PrintWriter out = new PrintWriter ( System . out ); int t = in . nextInt (); while ( t --> 0 ) { int num = in . nextInt (); int [] arr1 = new int [ num ]; int [] arr2 = new int [ num ]; int [] w = new int [ num ]; for ( int i = 0 ; i < num ; i ++){ arr1 [ i ] = in . nextInt (); } for ( int i = 0 ; i < num ; i ++){ arr2 [ i ] = in . nextInt (); w [ i ] = arr1 [ i ]* arr2 [ i ]; } int