Search found 15 matches
- Sat Jan 31, 2004 8:12 pm
- Forum: General
- Topic: Test Case Generator and Answer
- Replies: 12
- Views: 3337
Some easy to go code with Scruff's sample inputs
Here is some handy code I wrote for my self when I used Scruff's input files as my sample tests. I hope that this will come handy to many. Thanx scruff, your inputs really helped me get the problems right as I had the right data to test for. :D [cpp] /* Use cin and cout as you normally do in your pr...
- Sat Jan 31, 2004 5:56 pm
- Forum: Volume 1 (100-199)
- Topic: 100 - The 3n + 1 problem
- Replies: 1394
- Views: 209847
I think I know why the judge is rejecting your program. You are not looking out for spaces at the start of the input. Put some code that skips over spaces. A better way to do it is to use [cpp] isspace(aux ); [/cpp] as it skips over spaces, tabs, \r, \n etc. Really any kind of a character representi...
- Sat Jan 31, 2004 5:46 pm
- Forum: General
- Topic: Test Case Generator and Answer
- Replies: 12
- Views: 3337
Hey Scruff. Can you please either reduce the size of the downloadables or put the source on the website. I think that you are putting debug versions on the web. Please produce some release versions so that the size is reduced comsiderably. below 100 kb is good enough. Half an MB is way too big for a...
- Sat Jan 31, 2004 2:28 pm
- Forum: Volume 1 (100-199)
- Topic: 100 - The 3n + 1 problem
- Replies: 1394
- Views: 209847
I don't see anything wrong with the logic. If you are getting the wrong answer reply from the judge then there can only be one thing wrong. You are assuming three things. One that the the character set that the judge's computer is using has: '0' - '9' as consecutive characters. Two, that they are in...
- Fri Jan 30, 2004 5:10 am
- Forum: Volume 1 (100-199)
- Topic: 100 - The 3n + 1 problem
- Replies: 1394
- Views: 209847
- Fri Jan 30, 2004 5:07 am
- Forum: Volume 1 (100-199)
- Topic: 100 - The 3n + 1 problem
- Replies: 1394
- Views: 209847
You are right. I didn't think of that. Thanx for the help. :) I confused it with another question that did give 0 0 as the ending input. But I don't think that the second one should work either. The reason is that scanf returns the number of inputs read, not what was read. I haven't tested it but I ...
- Thu Jan 29, 2004 4:44 pm
- Forum: Volume 1 (100-199)
- Topic: 100 - The 3n + 1 problem
- Replies: 1394
- Views: 209847
I found out why the first one is accepted by the judge. The reason is that rather than handling the stdin directly, the judge simply redirects stdin to a file so when we read, it reads from a file. So when the EOF character of the file is encountered, the while loop exits. But EOF = 0 so the second ...
- Thu Jan 29, 2004 12:33 pm
- Forum: Volume 1 (100-199)
- Topic: 100 - The 3n + 1 problem
- Replies: 1394
- Views: 209847
Try this to improve your time
I don't know why it takes more time. Remove the condition [cpp] curNumber > 100 [/cpp] In a loop of a million, this will take more processing than it will without it. I have used the same learning technique using recursive decent rather than iterative. It gave me 0.131. see if you can gain some poin...
- Thu Jan 29, 2004 12:20 pm
- Forum: Volume 1 (100-199)
- Topic: 100 - The 3n + 1 problem
- Replies: 1394
- Views: 209847
Strange input problem...
Please can anybody tell me why the judge accepts the first one but doesn't accept the second one and gives a time-limit exceeded error. While on my computer with MSVC++ compiler it's exactly the opposite; the first one runs fine while in the second case time is exceeded because the loop doesn't exit...
- Thu Jan 29, 2004 7:46 am
- Forum: C++
- Topic: Very surprising
- Replies: 3
- Views: 2143
- Thu Jan 29, 2004 12:48 am
- Forum: Volume 1 (100-199)
- Topic: 102 - Ecological Bin Packing
- Replies: 485
- Views: 71708
How to insert asm into C/C++ code
It's no trade secret. All you have to do is to enclose it like this: [cpp]_asm nop;[/cpp] for single statement. Or make a block for multiple statements [cpp]_asm { }[/cpp] As C and C++ code can be almost directly converted to asm so the compilers don't have much trouble including any other asm code....
- Thu Jan 29, 2004 12:19 am
- Forum: C++
- Topic: automatic header inclusion
- Replies: 4
- Views: 2709
- Thu Jan 29, 2004 12:12 am
- Forum: C++
- Topic: a[++y]=a[y]+1;
- Replies: 15
- Views: 5172
- Wed Jan 28, 2004 11:53 pm
- Forum: C++
- Topic: Weird problem with debugger in MS visual C++
- Replies: 11
- Views: 4389
I am sorry. The correction I wanted to suggest was: [cpp]si[(strchr(tem,' ')-tem)] = 0; [/cpp] not si[tem+1]=0; Also as [cpp]tem += strlen(si);[/cpp] is after return thus, the infinite loop. Remember strlen uses null terminator to determine length. If you don't be careful of having null at the end, ...
- Wed Jan 28, 2004 11:44 pm
- Forum: C++
- Topic: Weird problem with debugger in MS visual C++
- Replies: 11
- Views: 4389
Yes the problem is quite strange to even many experience people. Well here it is in some detail char* = A non-const pointer to non-const memory. Both are modifiable const char* = A non-const pointer to a memory locatio that is const i.e. You can modify the pointer but not the memory it points to. ch...