onSH's blog

By onSH, 12 years ago, In English

I got am getting WR for this problem in testcase 33.

Input is :7 6 3
Output is:1/1 

When I run this program in my computer for this input its shows correct output. But When i submit here it gives WR(shows output 4/3). I don't know why ? Anyone can help me about this. Here is my Submission.

  • Vote: I like it
  • 0
  • Vote: I do not like it

| Write comment?
»
12 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

I guess it is a eps issure and a compile dependent ... ... Always check eps and use the same compile as the platform will be a wise idea for the similar issure.

»
12 years ago, # |
  Vote: I like it 0 Vote: I do not like it

3286407 — I just added "cout<<endl;" to your submission and it now get WA12. What's wrong with it?

  • »
    »
    12 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it
    for(long long i = m, j=1; j<=2; j++)
    

    What are you doing here? You don't use 'j' in your code after this Oo

»
12 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I just changed

 m = (x*p/y); 

to

 m = ( d*p ); [where d = (double)x/y. precalculated. ]

and got Accepted. Can any one explain why?

  • »
    »
    12 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    It works cause it not the same k*0.9999999 to k*1

    I think that it is because the type of the var "long"

    • »
      »
      »
      12 years ago, # ^ |
      Rev. 2   Vote: I like it 0 Vote: I do not like it

      But My Computer gives correct output for

       m = (x*p/y); 
      

      this code.

      • »
        »
        »
        »
        12 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        I had the same problem and I switched from int to long long for some variables and got accepted.

        It's really frustrating to get WA on a problem because of these kind of things.

        Similar things happened to me on SPOJ in some problems where you can't use iostream because it's too slow, but you can't use stdio either because it's incredibly unreliable with long long's. Sometimes %I64d works while %lld doesn't, and sometimes it's the other way around. You never know what to do.