09/01/07 18:36:38
>>350
#include <stdio.h>
int main(void)
{
int n;
scanf("%d", &n);
printf("%d\n", sum(n));
/*for (n=0; n<=100; n++) printf("%3d : %d\n", n, sum(n));*/
return 0;
}
int sum(int n)
{
return s(n / 3) * 3 + s(n / 5) * 5 - s(n / 15) * 15;
}
int s(int n)
{
return n * (n + 1) / 2;
}