ENG  RUS Timus Online Judge Online Judge
Problems
Authors
Online contests
Site news
Webboard
Problem set
Submit solution
Judge status
Guide
Register
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

## Discussion of Problem 1091. Tmutarakan Exams

I think I have problem with the __int64 type. Can anyone help me?
Posted by Kolio 29 Apr 2003 19:46
I've solved this problem in two different ways. I've tested the both
sollutions on my computer (I use Visual C++ 6.0) and they give the
same results on all the possible tests, but this one give WA and the
other is ACC. What's the problem with this? Maybe the __int64 type?
Can anyone help me?

#include <stdio.h>

#define N 64

int k,s;

int prime[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43,
47, 53};

//nad[i][j] is the number of the subsets with j elements of a set
//with i elements
{
for(int i = 2; i<=s; i++)
{
for(int j=1; j<i; j++)
}
}

bool hassquare(int a)
{
for(int i=0; prime[i]*prime[i] <= a; i++)
if( a% (prime[i]*prime[i]) == 0 )
return 1;

return 0;
}

int doit(void)
{
__int64 res = 0;
for(int i=2; i<=s; i++)
{
if( hassquare(i) )
continue;

int dels = 0;
for(int j=0; prime[j]<=i; j++)
dels += !(i%prime[j]);

if( dels%2 )
res += cur;
else
res -= cur;

}

res = (res>10000)?10000:res;
return (int)res;
}

int main(void)
{
scanf("%d%d", &k, &s);