N
N
nkorobkov2016-02-22 16:22:46
C++ / C#
nkorobkov, 2016-02-22 16:22:46

Did I solve the problem from VK correctly?

I came across this picture in contact:
0XEfO0WID88.jpg
In general, I counted the number of options (512) and I even wanted to count manually. I decided to write a C program that will go through all the options, and if a suitable combination comes out, it will display it on the screen.
Here's what I got:

#include <stdio.h>

int main()
{
    int arr[8];
    int i, j, k, res;
    for(i = 0; i < 8; i++){
        printf("Enter Arr[%d]\n", i);
        scanf("%d", &arr[i]);
    }
    for(i = 0; i < 8; i++){
        printf("%d\n", arr[i]);
    }
     for(i = 0; i < 8; i++){
        for(j = 0; j < 8; j++){
            for(k = 0; k < 8; k++){
                res = arr[i] + arr[j] + arr[k];
                printf("%d + %d + %d = %d\n", arr[i], arr[j], arr[k], res);
                if( (arr[i] + arr[j] + arr[k]) == 30 ) printf("First = %d\n Second = %d\n Third = %d\n", arr[i], arr[j], arr[k]);
            }
        }
    }
    return 0;
}

As a result, a suitable combination was not found. But here's the catch: not all values ​​were displayed in the console, but only those that start with 7+7+1...
Maybe I made a mistake and did not go through all the options? Or is the console size limited and some values ​​just don't show up? Help and do not scold, I'm just learning)

Answer the question

In order to leave comments, you need to log in

4 answer(s)
K
Kirill Arutyunov, 2016-02-22
@nkorobkov

Is it just me or adding 3 odd numbers will give an odd number anyway?

P
Pavel K, 2016-02-22
@PavelK

At first glance, everything is correct.
PS In my opinion, the problem does not have a head-on solution and it seems that additional actions (calculations in brackets, for example, or factorial) are not enough

N
Neonoviiwolf, 2016-02-22
@Neonoviiwolf

I remember there are three options
1) add decimal 13.1, etc.
2) turn over the 9-ku
3) write 3 and another 3, only mirrored in the first square (it will be 8)

E
entermix, 2016-02-22
@entermix

9.1+7.9+13=30

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question