Darko wrote:What if d == c*(c+1) ? Are you sure it's 2*c ?
Should be.
Wei-Ming Chen's problem is in precision.
- Code: Select all
c=(int)(sqrt(d)-0.01);
is too risky. Handle it in a more clear-cut way.
Output of
- Code: Select all
0 2147395601
is
- Code: Select all
92680
Remember, you need long in this problem.


