|
|
вернуться в форумnon correct statement? 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? I think u are not right. Re: non correct statement? 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 |
|
|