Search found 63 matches

by SRX
Sun Aug 13, 2006 6:07 pm
Forum: Volume 110 (11000-11099)
Topic: 11064 - Number Theory
Replies: 25
Views: 16335

This is how I am calculating the prime numbers.. //Here n is the number for which I am trying to find the primestwhile(x!=0) { while(x%y!=0 && y<x) y++; if (y>x || y==n) break; totient *= ((double)y-1.0)/(double)y; while(x%y==0) x=x/y; } For Example, a number say 84...the sequence it run thru is......
by SRX
Sun Jun 04, 2006 6:21 pm
Forum: Volume 110 (11000-11099)
Topic: 11043 - Fast and Easy Data Compressor
Replies: 5
Views: 2185

Your runtime error can be due to the fact that you are using char instead of unsigned char. Btw, Carriage return is '\n' like. I have got ac thanks to Emilio your hint make me think about negtive value :P hello , why char 's value can be negtive ? how does judge input char with negtive ascii value ?
by SRX
Sun Jun 04, 2006 5:10 pm
Forum: Volume 110 (11000-11099)
Topic: 11045 - My T-shirt suits me
Replies: 18
Views: 10421

Re: 11045 How to solve?

Ankur Jaiswal wrote:What is the approach to solve this problem??
Is it simple backtracking or is there some trick?
People have solved it in very less time.
So i guess there might be some trick.
there is no trick in this problem .
just think about matching .
:D
by SRX
Sun Jun 04, 2006 3:00 pm
Forum: Volume 110 (11000-11099)
Topic: 11043 - Fast and Easy Data Compressor
Replies: 5
Views: 2185

11043 - Fast and Easy Data Compressor

I ' m getting RunTimeError .

Can someone give me some test cases ?
btw , what is " carriage return"
thanks :D
by SRX
Wed May 31, 2006 8:14 am
Forum: Volume 110 (11000-11099)
Topic: 11038 - How Many O's?
Replies: 24
Views: 10506

mamun wrote:Can you use %I64d? Use %lld instead.
thanks :D
I use "%lld" and get ac now !
by SRX
Wed May 31, 2006 7:03 am
Forum: Volume 110 (11000-11099)
Topic: 11038 - How Many O's?
Replies: 24
Views: 10506

hi , I have solved this prob , and I use cin as input way Why if I use "scanf ( "%lld %lld" , &n , &m ) and scanf ( "%I64d , %I64d" , &n , &m )" , I get tle I have used the scanf to read the input, too, but without any problem with the time limit. Just make sure not to write the colon in "%I64d , %...
by SRX
Tue May 30, 2006 4:42 pm
Forum: Volume 110 (11000-11099)
Topic: 11038 - How Many O's?
Replies: 24
Views: 10506

hi , I have solved this prob , and I use cin as input way

Why if I use
"scanf ( "%lld %lld" , &n , &m ) and scanf ( "%I64d , %I64d" , &n , &m )"
, I get tle

Can someone answer me ?
thanks :D
by SRX
Sun May 14, 2006 3:54 pm
Forum: Volume 110 (11000-11099)
Topic: 11032 - Function Overloading
Replies: 43
Views: 17076

Re: 11032 - Function Overloading

Hello, everybody!!! How to solve this problem? I think that we can optimize function fun(int a) by replacing line: for(i=1; i<=a; i++){ to for(i=max(1, a-100); i<=a; i++){ But what to do with fun(int a, int b) ??? Thanks, bye! hi ...... your fun function to find "a input number" is almost the same ...
by SRX
Sat Dec 31, 2005 2:14 pm
Forum: Volume 109 (10900-10999)
Topic: 10973 - Triangle Counting
Replies: 31
Views: 13567

Moha wrote:What is your problem? WA or TLE?
the worst case for TLE is a bipartit graph. it has no triangle.
you can write a generator for this kind of input.
sorry , I got wa , I think my method won't get tle
by SRX
Sat Dec 31, 2005 1:41 pm
Forum: Volume 109 (10900-10999)
Topic: 10973 - Triangle Counting
Replies: 31
Views: 13567

Adrian Kuegel wrote:Your for-loops should go up to n, not to m.
Btw, you will get TLE with your method.
Can someone give some test cases , thanks .
I can't find my error :oops:
by SRX
Wed Dec 07, 2005 6:16 pm
Forum: Volume 109 (10900-10999)
Topic: 10905 - Children's Game
Replies: 66
Views: 26073

hi ...........

if(n==yl)
{
for(t=0;n<xl;n++,t++)
if(x[0+t]<x[n]) return 1;
else if(x[0+t]==x[n]) continue;
else return 0;
return 1 ;
}
by SRX
Sat Nov 05, 2005 1:56 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 189221

Re: a problem with 3n+1

you have too many error in your code
Can your compiler compile it successfully ?
by SRX
Sun Oct 30, 2005 1:14 pm
Forum: Volume 109 (10900-10999)
Topic: 10954 - Add All
Replies: 80
Views: 28432

tywok wrote:Also you can use multiset :wink:
thank you :)
I need to learn more stl
by SRX
Sun Oct 30, 2005 7:55 am
Forum: Volume 109 (10900-10999)
Topic: 10950 - Bad Code
Replies: 19
Views: 10667

hi
my output is
aaa
by SRX
Sun Oct 30, 2005 6:13 am
Forum: Volume 109 (10900-10999)
Topic: 10954 - Add All
Replies: 80
Views: 28432

Another way of staing the problem is , add two numbers from the list, add the result to the cumulative cost, remove the two numbers from the list and insert the sum to the list. The answer will be the minimum cumulative value obtainable. so, 2 2 2 2 3 -> (2+2=4) 4 2 2 3 -> (2+2=4) 4 4 3 ->(4+3=7) 7...

Go to advanced search