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 1206. Sum of Digits of the Sum of Numbers

non correct statement?
Posted by Mansurov Artur 9 Jul 2008 10:22
for K=2 we can get 1980 only if we assume that pairs
A=12 B=12
A=12 B=12
are two different pairs like
A=11 B=12
A=12 B=11
Re: non correct statement?
Posted by Chmel_Tolstiy 9 Jul 2008 14:44
I think u are not right.
Re: non correct statement?
Posted by bsu.mmf.team 17 Sep 2008 21:46
Yes, see this programm:

#include <iostream>
#include <math.h>

using namespace std;

int Sum (int n)
{
    int s=0;
    while (n)
    {
        s+=n%10;
        n/=10;
    }
    return s;
}

int main()
{
    int k=0;
    for (int i=10; i<100; i++)
    {
        for (int j=10; j<100; j++)
        {
            if (Sum(i)+Sum(j)==Sum(i+j))
            {
                k++; cout<<i<<" "<<j<<"\n";
            }
        }
    }
            cout<<k;
    return 0;
}

It returns 1980, but you can easily see that if i=j this pair wasn't counted twice