Search found 79 matches

by ec3_limz
Wed Dec 25, 2002 7:30 am
Forum: Volume 100 (10000-10099)
Topic: 10055 - Hashmat the Brave Warrior
Replies: 166
Views: 47307

I think that in MSVC, long data type is also 64-bit. This is not true for the GNU C++ compiler. BTW, I have a big problem when using C standard IO functions to print out the values of long long int variables. For example. [cpp]#include <stdio.h> int main() { printf("%lld\n", 2147483648LL); // 214748...
by ec3_limz
Tue Dec 24, 2002 7:43 am
Forum: Algorithms
Topic: dynamic programming aka DP
Replies: 4
Views: 1368

Hi epsilon0, I'm not particularly good in solving dynamic programming (DP) problems but I'll try to explain. DP is indeed a diffiucult topic to master. Dynamic programming is a technique that is usually applied on problems in which complete search will take too much time. It reduces the runtime of p...
by ec3_limz
Thu Dec 12, 2002 12:22 pm
Forum: Volume 4 (400-499)
Topic: 424 - Integer Inquiry
Replies: 96
Views: 20587

Hi,

Sometimes, even if a program is compilable in VC++, it may not be able to compile in the online judge because the online judge is using GCC, a different C++ compiler. Try compiling your program with DJGPP or Bloodshed Dev-C++.

Also, will you mind posting the replies from the judge's compiler?
by ec3_limz
Thu Dec 12, 2002 12:07 pm
Forum: Volume 7 (700-799)
Topic: 793 - Network Connections
Replies: 102
Views: 31678

input

Hi, This type of problems are pretty irritating when it comes to input. Here's how to do the input. Input the test case line by line into a string, and use a "string reader" to read the input from the string. If you are using C (like me), you use the function gets(str) to input the line into a strin...
by ec3_limz
Sun Nov 17, 2002 9:22 am
Forum: C++
Topic: Something's terribly wrong with long long ints
Replies: 1
Views: 1570

Something's terribly wrong with long long ints

To any kind soul, I have a very wierd problem when handling long long ints. Consider the following code. [cpp]#include <stdio.h> int main() { long long int a,b; scanf("%d%d",&a,&b); if (a>b) printf("%d",a-b); else printf("%d",b-a); return 0; }[/cpp] Now suppose I input: 2147483648 0 The output is: -...
by ec3_limz
Mon Nov 11, 2002 4:07 pm
Forum: Volume 1 (100-199)
Topic: 120 - Stacks of Flapjacks
Replies: 118
Views: 14083

#120 - WA

[cpp]#include <stdio.h> #include <stdlib.h> #include <string.h> int d[30]; inline int cmp(const void *a, const void *b) { return *(int*)a - *(int*)b; } void flip(int n) { int i, j, temp; for (i = 0, j = n; i < j; i++, j--) { temp = d ; d = d[j]; d[j] = temp; } } int main() { char line[257]; int size...
by ec3_limz
Mon Nov 11, 2002 8:44 am
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 189132

just a comment

I would like to comment although BC++ is ANSI/ISO compatible (if I remember correctly), one can modify compiler options such that code written in C++ can be compiled even if the source code is intended to be written fully in C.
by ec3_limz
Sun Nov 10, 2002 7:50 pm
Forum: Volume 1 (100-199)
Topic: 101 - The Blocks Problem
Replies: 635
Views: 42461

TOTALLY SICK OF GETTING WA FOR THIS PROBLEM!!!!!!

I don't know what the #%!* is the problem with my source code. Can anyone help me (either by pointing out the mistake or providing tons of test data)? Thanks. [cpp]#include <stdio.h> #include <string.h> int blocks, loc[25], pos[25][25], next[25]; void add(int block, int to) { loc[block] = to * 100 +...
by ec3_limz
Sun Nov 10, 2002 7:30 pm
Forum: Volume 6 (600-699)
Topic: 638 - Finding Rectangles
Replies: 13
Views: 5945

Yes there is a trick

Hi lowai, I recently found out that there may be a trick in this problem. I cannot, however, confirm that what I say is correct. The problem did NOT state that all rectangles must be parallel to the axes. This means that rectangles can be in any "direction", e.g. diamonds. For example. SAMPLE INPUT ...
by ec3_limz
Sun Nov 03, 2002 8:58 am
Forum: Volume 3 (300-399)
Topic: 333 - Recognizing Good ISBNs
Replies: 166
Views: 22481

#333: Recognizing Good ISBNs - WA

Can anyone tell me why my program gets a WA? I was so sure that I was correct! [cpp]#include <stdio.h> #include <string.h> int main() { bool valid; char isbn[81]; int len, sum, sum2, i, j; while (scanf("%s", &isbn) == 1) { valid = true; sum = sum2 = 0; len = strlen(isbn); for (i = 0, j = 0; i < len;...
by ec3_limz
Wed Oct 30, 2002 11:53 am
Forum: Volume 1 (100-199)
Topic: 101 - The Blocks Problem
Replies: 635
Views: 42461

WA for me

Got WA for this code, what's wrong? BTW, add() adds a block to another stack, and remove() returns a block to its original stack. Please help me... [cpp]#include <stdio.h> #include <string.h> int blocks, loc[25], pos[25][25], next[25]; void add(int block, int to) { loc[block] = to * 100 + next[to]; ...
by ec3_limz
Mon Oct 28, 2002 10:41 am
Forum: C
Topic: Scan of input file ....
Replies: 14
Views: 11576

Problem with sscanf()

Thanks Yarin. But I have another problem. I seem to encounter errors when my program tries to read multiple integers using sscanf(). Here's what I mean. [cpp] while (gets(line)) { if (strlen(line) == 0) break; for (int i = 0; sscanf(line, "%d", &d ) == 1; i++); } [/cpp] So, for example, I input the ...
by ec3_limz
Fri Oct 25, 2002 9:43 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 189132

cheating...

Haha...

Try cheating in Problem #136, since there is no input for that problem and the output is always the same. Just print the answers; who cares about the calculation. :D
by ec3_limz
Fri Oct 25, 2002 2:27 pm
Forum: C
Topic: Scan of input file ....
Replies: 14
Views: 11576

detecting blank lines

I have a problem with problems with multiple input :evil: How do I detect the blank lines between test cases when using scanf() to scan in ints? Here is what I mean. // start of input file 3 5 3 6 // end of input file How do I detect that "3 5" is one test case, and "3 6" is another? Thanks. I need ...
by ec3_limz
Fri Oct 25, 2002 2:18 pm
Forum: C++
Topic: Bigint
Replies: 37
Views: 17394

classes...

I uses struct instead :D but without any functions.

Yes I agree that classes make your code cleaner. Use them whenever you need to.

Go to advanced search