ACM (TJU) : 3259


#include
#include

int a [1000002] = {0};

int main ()
{
int i, j;

for ( i = 1; i <= 1000000; i++ ) { for ( j = i; j <= 1000002; j+=i ) a [j]++; } int low, high; while ( scanf ("%d %d", &low, &high) != EOF ) { int count = 0; for (int i = low; i <= high; i++ ) { if ( i % a [i] == 0 ) count++; } printf ("%d\n", count); } return 0; } [/sourcecode]

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s