Quantcast
Viewing all articles
Browse latest Browse all 39796

Enormous input test (INTEST)

Here's my code :

#include <stdio.h>
int main (void) {
unsigned long long t, y, z, a;
a = 0;
scanf ("%I64u %I64u", &t, &y);
for (t; t > 0 ; --t) {
scanf ("%i", &z);
if (t == 0)
break;
else if (z % y == 0)
++a;
} 
printf ("%i\n", a);
return 0;
}

I am a beginner and I haven't learnt about arrays, functions or an other advanced topics. Is it possible to optimize this solution without using any advanced features of C. I know about looping using for, while and do statements and decision making with if and else if. The above code exceeds the time limit.


Viewing all articles
Browse latest Browse all 39796

Trending Articles



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