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 1120. Sum of Sequential Numbers

WHY WA 10# ?
Posted by Razvan Brezulianu 20 Apr 2007 13:24
my code!
please help!
thanks!

#include<stdio.h>
#include<math.h>

long i, j, n, div, p, a;

int main()
{
    scanf("%ld", &n);

    for(i = sqrt(n); i >= 1; i--)
        if(n % i == 0)
        {
            p = i * 2;
            a = n / (p / 2) - (p - 1);
            if(a % 2 == 0 && a / 2 >= 0)
            {
                a = a / 2;
                i = 0;
            }
        }

    printf("%ld %ld\n", a, p);

    return 0;
}

Edited by author 20.04.2007 13:25

Edited by author 20.04.2007 13:25