I keep getting a 'wrong answer' for my ACODE solution, but I can't find any problems with the ouput of my program. My program perfectly conforms to the example I/O, and all other input I've tried properly gives me the solutions I expected.

From the example:

$ cat input
25114
1111111111
3333333333
0
$ ./acode < input
6
89
1

Testing long input:

$ perl -le 'print (3x5000)."\n0"' | ./acode
1

I use printf("%lld\n") to output an integer of type 'long long', one possibility could be that the server doesn't use 64 bits for that, but I doubt the GCC 4.0.0-8 on the server would be that much different from the GCC 4.3.1 I use.

Could someone provide me with a bit more example I/O on which my program may fail, or any other suggestions?

  • created

    Sep '08
  • last reply

    Sep '08
  • 1

    reply

  • 116

    views

  • 1

    user

Found the problem!

My code didn't properly handle zeros, and thought '226210' had 6 possibilities instead of just 3. My solution got accepted after that was fixed.

Suggested Topics

Topic Category Replies Views Activity
C and C++ 0 38 29d

Want to read more? Browse other topics in C and C++ or view latest topics.