Thread: What's the problem about this program?

  1. #16
    Registered User
    Join Date
    Apr 2005
    Posts
    77
    ? what do you mean? vart?

  2. #17
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    > Shouldn't you use I64d format instead of lld?
    He means that %lld isn't standard yet, which means you have to know (or guess) which compiler the judge is using.

    If it's really a Linux based gcc implementation, then it's probably %lld
    If it's some microsoft compiler, or a windows port of gcc like MinGW or dev-c++, then use %I64d

    > scanf("%lld", &x);
    It might help if you check the return result, and issue an error message if the conversion failed (which might also help if you specify an unknown conversion).
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #18
    Registered User
    Join Date
    Apr 2005
    Posts
    77
    oh!!!!!!!!!!!! you're right! I complie the code based on Linux gcc implementation. I think the online judge is based on Microsoft system. The code is pass. Thank everyone to help me.

  4. #19
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    I just remember that in the JUDGE's FAQ was some note about using I64d format for long long numbers... I think you should read carefully the all information available about the assignment, not only what is posted in the task description itself
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Multi Thread Program Problem
    By ZNez in forum C Programming
    Replies: 1
    Last Post: 01-03-2009, 11:10 AM
  2. Program Termination Problem
    By dacbo in forum C Programming
    Replies: 3
    Last Post: 01-23-2006, 02:34 AM
  3. Inheritance and Dynamic Memory Program Problem
    By goron350 in forum C++ Programming
    Replies: 1
    Last Post: 07-02-2005, 02:38 PM
  4. Replies: 20
    Last Post: 06-12-2005, 11:53 PM