Search found 90 matches

by bery olivier
Sun Mar 16, 2003 12:38 am
Forum: Volume 101 (10100-10199)
Topic: 10190 - Divide, But Not Quite Conquer!
Replies: 105
Views: 23847

[c] while(1) { r=scanf("%lld%lld",&n,&m); if(r==EOF) break; [/c] Humm, :-? This seems incorrect to me. You can use [c] while(1) { r=scanf("%lld%lld",&n,&m); if(m==EOF || n==EOF) break; [/c] or better : [c] while(1) { r=scanf("%lld%lld",&n,&m); if(r!=2) break; [/c] But I don't really like this. Bett...
by bery olivier
Fri Mar 14, 2003 3:44 pm
Forum: Volume 2 (200-299)
Topic: 227 - Puzzle
Replies: 56
Views: 9225

I used C as well. I didn't use gets() but getchar() or scanf("%c"). So I didn't get any trouble with spaces.
Is it really more safety with sscanf ??? What is the difference between (scanf() or getchar()) and sscanf() when we got spaces in the input ?
Thanks for your help.
by bery olivier
Thu Feb 27, 2003 2:40 pm
Forum: Volume 104 (10400-10499)
Topic: 10451 - Ancient Village Sports
Replies: 22
Views: 9539

Shame

:oops: I'm so ashamed :roll:
Sure it's 1 and not 0. Sorry for that. I should stop alcohol.
by bery olivier
Thu Feb 27, 2003 1:13 pm
Forum: Volume 104 (10400-10499)
Topic: 10451 - Ancient Village Sports
Replies: 22
Views: 9539

Re: 10451

2481RE wrote:I tried 2/cos(0) but it didn't work.
This doesn't work cause 2/cos(0)=2/0 !!!!!!
Better use the definition as turuthok said or cos^-1(-1)
PI=2*acos(0)=acos(-1)
by bery olivier
Wed Feb 26, 2003 8:36 pm
Forum: C++
Topic: How to combine a char & a word ?!?
Replies: 13
Views: 5082

It doesn't work for two reasons : Thirst, you didn't allocate any memory for your string : [c]char *s,c;[/c] and then this is illequal [c]s="word";[/c] and should be replaced by : [c]strcpy(s,"word");[/c] This works : [c] void strchrcat(char *s, char c) { while (*(s++)); *s = c; *(s + 1) = \0; } int...
by bery olivier
Mon Feb 24, 2003 10:01 pm
Forum: Other words
Topic: Pascal, C, C++ or Java ? !!!
Replies: 19
Views: 3691

confirmation

C goes very fast, it's the most taught and it's the easier to use with Linux :D . C++ has some built functions like hastable, but it's slower. The inputs / outputs are easier than in C. Java is still slower but there is a lot of useful things (hashtable, BigInteger, BigDecimal, lists already done, a...
by bery olivier
Fri Feb 21, 2003 8:32 pm
Forum: Other words
Topic: Pascal, C, C++ or Java ? !!!
Replies: 19
Views: 3691

I only use C, but a lot of people seem to prefer C++. So I won't say C is better. It's not really important for the contest, but GTK mean Gimp ToolKit. It was created by the Gimp programmers. It's a tool based on an infinite loop whitch allow to use the mouse and the keyboard in real time. It a C-up...
by bery olivier
Fri Feb 21, 2003 6:39 pm
Forum: Other words
Topic: Pascal, C, C++ or Java ? !!!
Replies: 19
Views: 3691

Anyway, what about C++? Is not better than C??? I want to know. There are not many differences between C and C++. I wouldn't say that it is better.Actually, I never tried C++ for any problem and I don't even know why it's used here. I use C (or java if built functions are needed) for algorithms prg...
by bery olivier
Fri Feb 21, 2003 6:02 pm
Forum: Other words
Topic: Pascal, C, C++ or Java ? !!!
Replies: 19
Views: 3691

definitly C

I don't know Pascal, but I think that C and java are the best. The fact that they are the most popular languages is not a chance. In my opinion, you can do things faster in C (I always use C) cause you write almost everything. Java could be useful for some problem as lots of things are already done ...
by bery olivier
Thu Feb 20, 2003 6:07 pm
Forum: Volume 3 (300-399)
Topic: 382 - Perfection
Replies: 95
Views: 19065

I tried to send your source and I got WA. For 1 it gives me "PERFECT" but in this case |c|=1. Try this
[c]sum=0;
for(i=1; i<=n/2; i++) [/c]
It should be Acc.


You should remove the second \n after END OF OUTPOUT as well cause it'll give P.E.


Hope that it helps :wink: .
by bery olivier
Thu Feb 20, 2003 5:51 pm
Forum: Volume 3 (300-399)
Topic: 382 - Perfection
Replies: 95
Views: 19065

You didn't say what doesn't work. If it's an input problem, I guess that this : [c] while(scanf("%ld",&n)!=EOF) [/c] should be replaced by this : [c] while(scanf("%ld",&n)==1) or while(scanf("%ld",&n)!=0) or while(scanf("%ld",&n)>0) or while(scanf("%ld",&n)) [/c] Cause scanf return the number of inp...
by bery olivier
Sun Feb 16, 2003 8:53 pm
Forum: Volume 2 (200-299)
Topic: 227 - Puzzle
Replies: 56
Views: 9225

227 puzzle

Hi folks, I wrote a source to solve "the puzzle" and I got WA :(. However I tested it with a lot of differents inputs and a real puzzle and my program always gave me the good answer. I don't have a single clue of what doesn't work. Is there something I should take care ? Please let me know what coul...
by bery olivier
Sun Feb 16, 2003 12:18 am
Forum: Volume 104 (10400-10499)
Topic: 10450 - World Cup Noise
Replies: 42
Views: 19964

Well anyway, the first time I sent my source I got WA. Then I print the 4 last numbers ( if(51) printf("XXX"); I know it's not really beautiful, but it was accepted. I'll try to improve it) and it worked perfectly. I don't know what's the matter. Maybe something wrong whit my compiler or something e...
by bery olivier
Sat Feb 15, 2003 5:11 pm
Forum: Volume 104 (10400-10499)
Topic: 10450 - World Cup Noise
Replies: 42
Views: 19964

Larry wrote:How about I give you a recurrence?
T(n) = T(n-1) + T(n-2)

This fits in long long..
I finally got Acc :D . But I think long long isn't enough for the 5 last numbers. I had to cheat a little to succed.
Thanks a lot larry.


_________________
Theocrite le Newbee
by bery olivier
Sat Feb 15, 2003 1:58 am
Forum: Volume 104 (10400-10499)
Topic: 10450 - World Cup Noise
Replies: 42
Views: 19964

10450 - World Cup Noise

Hi ! I tried to solve "world cup noise" 4 times but I only got Time Limit Exeeded and WA. :cry: I know it seem to be an easy problem. But I really don't understand why I can't manage to get Acc. Is that anybody could give me a heap of sample input/outpout Thanks. ______________________ --- Theocrite...

Go to advanced search