ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1224. Spiral

I’ve AC, but I still have a question!
Posted by Veniamin 18 Mar 2005 16:06
I’ve AC, but I still have a question!

My first program used “unsigned long” type, and didn’t pass Test 12

Then I changed all types to “unsigned long long” , and program was AC.

So, my question is why my first program failed on Test12?

As you know n,m<=2^31-1;So, the biggest result is 0xFFFFFFFD! This result can be represented by unsigned long!

So, I didn’t announce my program, because it is bad style. I’m sure that those programmers who solved this issue can understand my question….

Best Wishes,
Veniamin.
Re: I’ve AC, but I still have a question!
Posted by [ za-Nuker ]™ 27 Apr 2006 19:44
Each of n and m is <= 2^31-1. Yes, they are unsigned long.

But max unsigned long + 1 is? Overflow, of course !!

Your solution doesn't print n or m exactly but you have to calculate either 2*m or 2*n, aren't you?
Re: I’ve AC, but I still have a question!
Posted by Pegasus 10 Oct 2012 17:32
Thanks.I also meet this question.