Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 39796

time limit exceeded problem plz help

$
0
0
import java.util.Scanner;
class cc {


public static void main(String args[]){
  long n,x,k;
  int c=0;

    Scanner input =new Scanner (System.in);

    n=input.nextLong();
    k=input.nextLong();


    while(n>0){

        x=input.nextLong();
               if(x%k==0){

                     c++;     
                          }


               n--;
               }

              System.out.printf("%d",c);
}




    }

This is the code I wrote for prob Enornous Input Test (from practice Easy)... link--http://www.codechef.com/problems/INTEST

Same program was submitted by me in C lang..and It was accepted giving no error...But when I converted it to Java it is showing time limit exceeded problem....


Viewing all articles
Browse latest Browse all 39796


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>