Search found 6 matches

by unuguntsai
Thu Aug 25, 2005 4:23 am
Forum: Volume 101 (10100-10199)
Topic: 10193 - All You Need Is Love
Replies: 23
Views: 13091

10193 Why WA pls help~

I can't find why WA and sample i/o i'm all right #include <stdio.h> #include <stdlib.h> unsigned long int power( int exp ) { unsigned long int ans = 1 ; for( int i = 0 ; i < exp ; i++ ) ans *= 2 ; return ans ; } int main() { int time ; unsigned long int s , l ; char num[30] ; int prime[4792] , i , C...
by unuguntsai
Mon Aug 22, 2005 7:37 am
Forum: Volume 6 (600-699)
Topic: 623 - 500!
Replies: 187
Views: 67752

623 Why RE??

I don't know why RE?? #include <stdio.h> #include <stdlib.h> #define LEN 2600 #define MAX 1001 int main() { int num[MAX][LEN] , n , i ; for( i = 0 ; i < MAX ; i++) for( int j = 0 ; j < LEN ; j++ ) num[i][j] = 0 ; num[0][0] = 1 ; num[1][0] = 1 ; for( i = 2 ; i < MAX ; i++ ) { for( int j = 0 ; j < LEN...
by unuguntsai
Tue Aug 16, 2005 7:12 am
Forum: Volume 5 (500-599)
Topic: 583 - Prime Factors
Replies: 171
Views: 58471

Hi you have generated prime up to 46337 and your prime counter value Cprime is 4791 when the input is 2147483647 and prime = 46337 and i = 4791 at that time your this condition prime * prime <= x will satisfied but when you increase i at that time prime[4792] will contain a garbage value because yo...
by unuguntsai
Tue Aug 16, 2005 5:27 am
Forum: Volume 5 (500-599)
Topic: 583 - Prime Factors
Replies: 171
Views: 58471

I think you should change this: for( i = 0 ; prime[i]*prime[i] <= x ; i++ ) { ... } into: for( i = 0 ; i < Cprime && prime[i]*prime[i] <= x ; i++ ) { ... } that is possibly your mistake :wink: thank you angga888~ i got AC already~ :D but why i need to put " i < Cprime " in my code...
by unuguntsai
Mon Aug 15, 2005 11:23 am
Forum: Volume 5 (500-599)
Topic: 583 - Prime Factors
Replies: 171
Views: 58471

My Output

2147483647 = 2147483647

is it OLE ??
by unuguntsai
Mon Aug 15, 2005 5:33 am
Forum: Volume 5 (500-599)
Topic: 583 - Prime Factors
Replies: 171
Views: 58471

583 Why Output Limit Exceeded ??

I don't know why OLE ?? #include <iostream.h> #include <stdlib.h> int main() { long long int n , x ; long long int prime[4792] ; int i , Cprime , k , ans ; for( k=3 , Cprime=1 , prime[0]=2 ; k<46341 ; k+=2 ) { for( i=0 ; prime[i]*prime[i] < k ;i++ ) if(k%prime[i]==0) break; if(prime[i]*prime[i]>k) p...

Go to advanced search