Find all two-digit numbers equal to twice the product of their numbers.
Closed due to the fact that the essence of the issue is incomprehensible to the participants Kromster , user194374, D-side , Duck Learns to Hide , andreycha 2 Sep '16 at 9:07 .
Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .
- oneHomework without attempting to solve, the heritage of the hashcode is still. Keep open does not make sense. - Duck Learns to Hide
|
1 answer
for (int i = 1; i < 10; i++) { for (int j = 0; j < 10; j++) { if ((i * j) << 1 == (i * 10 + j)) std::cout << i << j << std::endl; } } Gives out only 36 =)
- Can you explain the algorithm robot in words? - nullptr
- We iterate over all pairs of digits - all possible two-digit numbers from 10 to 99, if the double product of the first digit by the second is equal to the number itself (that is, the first digit multiplied by 10 plus the second), then we derive a number consisting of these digits. - Kozlov Sergei
3 * 6 == 6 * 3, in my opinion, you can shorten the first cycle to 4 iterations (49 - the last pair) - Specter
|