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

why this code is giving a time limit exceeded problem?

$
0
0
#include <stdio.h>

int main()
{
    long long int n;
    long long int k;
    long long int a[1000000];
    int i;
    int count;
    count = 0;
    scanf("%lld", &n);
    scanf("%lld", &k);
    for(i = 0; i < n; i++) {
        scanf("%lld", &a[i]);
        }
    for(i = 0; i < n; i++) {
        if (a[i]%k == 0)
            count++;
    }
    printf("%d\n", count);

    return 0;
}

Viewing all articles
Browse latest Browse all 39796

Trending Articles



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