Search found 162 matches

by newton
Thu Oct 23, 2008 8:40 pm
Forum: Volume 102 (10200-10299)
Topic: 10282 - Babelfish
Replies: 48
Views: 19556

Re: 10282 - Babelfish

jahin wrote:
got ac
if it is

remove ur AC code please
by newton
Sun Oct 19, 2008 10:23 pm
Forum: Volume 108 (10800-10899)
Topic: 10815 - Andy's First Dictionary
Replies: 116
Views: 30593

Re: 10815 - Andy's First Dictionary

Why RE. please any one check my small code #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> #define MAX 5001 using namespace std; int comp(const void *a, const void *b) { return strcmp((char *)a,(char *)b); } int main(){ char str[2000],*p; char word[MAX][100]; char dil[] = ...
by newton
Wed Oct 15, 2008 7:45 am
Forum: Volume 108 (10800-10899)
Topic: 10843 - Anne's game
Replies: 19
Views: 9480

Re: 10843 - Anne's game

why WA. please give me some critical input output. my code #include <cstdio> int getMod(int a,int b,int c){ int i,n = a; if(a == 1 || a == 2) return 1; for(i = 1; i< b; i++){ a *= n; a %= c; } return a%c; } int main(){ int b,i,test; //freopen("in.txt","rt",stdin); scanf("%d",&test); for(i = 1;i <= t...
by newton
Sat Sep 27, 2008 6:33 pm
Forum: Volume 102 (10200-10299)
Topic: 10200 - Prime Time
Replies: 202
Views: 61080

Re: 10200 - Prime Time

if else series made the code more complex.u need not to precalculate count. 1. make store boolean. 2. set store[p] = isPrime[p] for 0 to MAX 3. replace ur code to.. while(scanf("%d %d",&a,&b) == 2){ cnt = 0.0; for(i = a; i<=b; i++){ if(store[i]) count = count + 1; } printf("%.2lf\n",(count*100.00/(b...
by newton
Fri Sep 26, 2008 3:05 pm
Forum: Volume 102 (10200-10299)
Topic: 10200 - Prime Time
Replies: 202
Views: 61080

Re: 10200 - Prime Time

u need not to generate primes up to sqrt of 100010041 using sieve.
Just:

Code: Select all

             My Algorithm was

1. make an Boolean array of 10001
2. check isPrime( i*i + i + 41) for i-> 0 to MAX
3. set array[i] true if isPrime return true;
4. scan inputs and get your answer.
by newton
Wed Sep 24, 2008 9:59 pm
Forum: Volume 3 (300-399)
Topic: 315 - Network
Replies: 68
Views: 21347

Re: 315 Network

i cant figure out why WA. anybody here to check my code? #include <cstdio> #include <vector> #include <string> #include <algorithm> #define INF 1<<29 #define MAX 2000 #define WHITE 0 #define GRAY 1 #define BLACK 2 using namespace std; /*****************Global varables *****************/ bool isInser...
by newton
Wed Sep 24, 2008 9:06 pm
Forum: Volume 3 (300-399)
Topic: 315 - Network
Replies: 68
Views: 21347

Re: 315: Network

Dfs Visit always generate a tree or forest. As the graph is connected undirected it will produce a forest with only one tree. Then If the root has more then one children u must treat the root as articulation point.

sorry for my bad english.
by newton
Wed Sep 24, 2008 8:58 pm
Forum: Volume 3 (300-399)
Topic: 315 - Network
Replies: 68
Views: 21347

Re: 315 getting WA

Answer must be 0
by newton
Mon Sep 22, 2008 10:24 pm
Forum: Volume 100 (10000-10099)
Topic: 10004 - Bicoloring
Replies: 93
Views: 29321

Re: 10004 - Bicoloring WA

Fuad Hassan EW

what was your algorithm?
you can place your code.
by newton
Sun Sep 21, 2008 8:13 pm
Forum: Volume 3 (300-399)
Topic: 336 - A Node Too Far
Replies: 121
Views: 39751

Re: Prob 336(A Node Too Far)-- Runtime Error

enlage size 30 to 100
probably there was a misleading description in specification.
by newton
Wed Sep 17, 2008 10:03 pm
Forum: Volume 5 (500-599)
Topic: 583 - Prime Factors
Replies: 171
Views: 36747

Re: 583 - Prime Factors TLE

why TLE plz help whene i solved the problem after generating primes. But now if i dont handle only with primes the code gets TLE. #include <cstdio> int absValue(int a){ if(a<0) return -a; else return a; } int main(){ int num,i; bool s; while(scanf("%d",&num) == 1 && num){ s = false; if(absValue(num)...
by newton
Tue Sep 09, 2008 12:39 am
Forum: Algorithms
Topic: finding Nth term of a series!
Replies: 2
Views: 1593

Re: finding Nth term of a series!

Yes i got it.
i think

Code: Select all

term(N)= a*(N-1)C1 + d1*(N-1)C2 + d2*(N-1)C3 + ........ + while di not constant.
a = first element = term(1)
by newton
Mon Sep 08, 2008 9:23 pm
Forum: Volume 1 (100-199)
Topic: 147 - Dollars
Replies: 233
Views: 20975

Re: 147 __int64 can't hold big results.Please help

I cant figure out what is the problem of my code. It simply gives me WA. please help me. #include <cstdio> #include <cmath> #include <algorithm> #define MAX 6001 #define eps 1e-7 using namespace std; int coins[] = {1, 2, 4, 10, 20, 40, 100, 200, 400, 1000, 2000}; unsigned long long ways[MAX]; void s...
by newton
Sun Sep 07, 2008 1:04 pm
Forum: Volume 5 (500-599)
Topic: 516 - Prime Land
Replies: 23
Views: 6516

Why PE 516!

please anyone point me the reason of getting PE. i thought but couldn't find. My code: #include <cstdio> #include <cmath> #include <cstdlib> #include <algorithm> #define MAX 32767 using namespace std; typedef long long LL; bool isPrime[MAX]; int array[MAX]; int sum[MAX]; int primes[MAX]; LL getPow(i...
by newton
Wed Sep 03, 2008 8:57 pm
Forum: Volume 4 (400-499)
Topic: 497 - Strategic Defense Initiative
Replies: 144
Views: 21004

Re: Wa 497 Strategic Defense Initiative

i cant figure out why WA? please help me. code: #include <cstdio> #include <string> #include <algorithm> #define INF 1<<29 #define MAX 100000 using namespace std; int A[MAX]; int L[MAX]; int P[MAX]; int maxLenth(int array[], int n){ int max = -INF,i; for(i = 0; i<n; i++) if(array[i] > max) max = i; ...

Go to advanced search