Hi,
Can anyone tell me why this algorithm gives TLE
Thanks
#include <stdio.h>
#include <math.h>
int factors[46342];
unsigned int primes[46342];
void fillPrimes()
{
for(int i = 0; i < 46342; i++)
{
primes[i] = 1;
}
for(unsigned int i = 2; i < 46342; i++)
{
if(primes[i] == 1)
{
for ...
Search found 3 matches
- Thu Dec 14, 2006 11:47 pm
- Forum: Volume 5 (500-599)
- Topic: 583 - Prime Factors
- Replies: 171
- Views: 61329
- Tue Dec 12, 2006 10:55 pm
- Forum: Volume 4 (400-499)
- Topic: 446 - Kibbles "n" Bits "n" Bits "n" Bits
- Replies: 50
- Views: 11490
446 WA
Hi,
Can anyone tell me why this code give WA?
Thanks
#include <stdio.h>
#include <string.h>
char buf1[100], buf2[100];
void reverse(char * begin, char * end)
{
char temp;
while(end > begin)
{
temp = *end;
*end-- = *begin;
*begin++ = temp;
}
}
void itoa(int value, char* str, int base ...
Can anyone tell me why this code give WA?
Thanks
#include <stdio.h>
#include <string.h>
char buf1[100], buf2[100];
void reverse(char * begin, char * end)
{
char temp;
while(end > begin)
{
temp = *end;
*end-- = *begin;
*begin++ = temp;
}
}
void itoa(int value, char* str, int base ...
- Tue Dec 05, 2006 11:04 pm
- Forum: Volume 5 (500-599)
- Topic: 530 - Binomial Showdown
- Replies: 137
- Views: 49098
Wrong Answer for 530
Hi,
Could anyone tell me the mistake with this code?
Thanks
#include <stdio.h>
int main()
{
int n, m;
while(scanf("%d", &n) > 0 && scanf("%d", &m) > 0)
{
if(n == 0 && m == 0)
{
break;
}
else if(n == m)
{
printf("1\n");
}
else if (m == 0)
{
printf("0\n");
}
else
{
int d = n ...
Could anyone tell me the mistake with this code?
Thanks
#include <stdio.h>
int main()
{
int n, m;
while(scanf("%d", &n) > 0 && scanf("%d", &m) > 0)
{
if(n == 0 && m == 0)
{
break;
}
else if(n == m)
{
printf("1\n");
}
else if (m == 0)
{
printf("0\n");
}
else
{
int d = n ...