st1008's blog

By st1008, history, 3 years ago, In English

My solution to a recent problem was found very similar to another user however the question had little to do with logic. It was a simple question that required a very trivial solution.

here is the link: https://mirror.codeforces.com/contest/1846/problem/A

and my submission: /* 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. */ public class Codechef { public static void main (String[] args) throws java.lang.Exception { // your code goes here Scanner sc =new Scanner(System.in); int t=sc.nextInt(); while(t-->0) { int n=sc.nextInt(); int a[]=new int[n]; int b[]=new int[n]; for(int i=0;i<n;i++) { a[i]=sc.nextInt(); b[i]=sc.nextInt();

     }
     int c=0;
     for(int i=0;i<n;i++)
     {
         if(a[i]>b[i])
         c++;
     }
     System.out.println(c);

 }
}

}

What should I do to avoid any penalties?

Full text and comments »

  • Vote: I like it
  • +10
  • Vote: I do not like it