Solved the problem of cycles, you need to draw a rhombus, filled with the symbol "X". As a result, I could not decide on my own. I want to ask how scary it is if I could not solve the problem of such a plan and what would you advise me to correct such moments?

Closed due to the fact that off-topic participants aleksandr barakin , VenZell , Nick Volynkin 4 Feb '16 at 5:58 .

  • Most likely, this question does not correspond to the subject of Stack Overflow in Russian, according to the rules described in the certificate .
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • Math.round (n / 2) -1 spaces; 1 cross Math.round (n) -2 spaces; 2 crosses ... 1 spaces; n-1 crosses 0 spaces; n-crosses 1 spaces; n-1 crosses ... Math.round (n / 2) -1 spaces; 1 cross Math.round (n) -2 spaces; 2 crosses Here is the solution, do not be lazy to write - kandi
  • 2
    I vote for closing this question as irrelevant to the topic, because it has nothing to do with programming or administration. - aleksandr barakin

4 answers 4

Algorithmic thinking to develop and imagination =)

For this particular task - to draw the same thing on a piece of paper character by character and figure out how to do the same thing programmatically.

X XXX XXXXX XXXXXXX XXXXX XXX X 

If there are ideas, how such problems are solved, then it means that we need to practice the syntax and possibilities of the language. That is, read the literature on it and solve puzzles. To understand how to program to write your invented algorithm.

  • Not to conclude that a bad programmer will come out of me? - ArniLand
  • Use comments. Well, learn and learn, what else to say? =) The fact that someone cannot find a derivative in grade 10 does not mean that he will never succeed. If there was a stimulus ... - Alexey Sonkin
  • 2
    The fact that you did not solve this problem undoubtedly indicates a low development of the corresponding mentality. This means that it will not work right now. However, as the previous respondent already said, this does not mean at all that you are not capable at all. In order to achieve your goal, you need to work a lot on yourself. If you are <= 18 years old, then nothing is lost, and if> 20, then you have to plow and plow, because a lot of time has already been lost. - cy6erGn0m
  • To solve more programming problems - a way to solve this problem? - ArniLand
  • 2
    The way that helped me many years ago when I was still a child: every time I saw something, I wondered how it was done? How would I do this? How would I do it if I was limited, like a car? It is important not to try to solve a solution under any pretext, but to work out at least some kind of solution. Such an unhealthy interest ended with the fact that, for example, I finally got my way. - cy6erGn0m

I would advise you to structure your thoughts and ideas about the task first.

For example, a diamond.

I see that here you need 2 functions (for me personally):

  1. A function that takes as input a string consisting of X and complements it to the total length with spaces on the right and left, i.e. centers.
  2. A function that accepts a diamond's width and height. It will simply divide the height in half, and cycle through to the middle of the height, adding X, and then cutting back X from the line, each time passing the value to the first function and adding the result to the output variable.

This is how the logic of solving this problem looks in my head at the time of its presentation.

    In general, the success of problem solving is not a sufficient criterion for the self-assessment of abilities, but it is a sufficient criterion for the self-assessment of a skill. Programming as a form of mental labor includes, at a minimum:

    1. algorithm development
    2. writing texts

    The development of algorithms requires mathematical abilities, writing texts requires linguistic abilities. In the case of the presence of these (and at the end of high school it is already obvious whether they have such abilities or not) sooner or later the skill of solving programming problems will come;

    • One way to solve more problems with programming? You write that sooner or later the skill will come, and in the absence will not come. It is not clear in the absence of what? - ArniLand
    • Mathematical and language skills are important. Everything else will come with practice. - stanislav

    The best way to learn is to teach others. Go through the sites and find one where careless schoolchildren and students are asked to solve tasks for them. Try to solve. Do not think that you can not. You have no idea what kind of trivialism is often asked there, at the level of "add two numbers and display the amount on the screen." Can't do it yourself - wait for someone else to respond. Look at his decision, try to understand his logic.

    I advise three books: Jacques Arsac - Programming games and puzzles; Kernigan, Ritchie - C programming language; Brody - The initial course of programming in the Fort language.

    Oh, and I almost forgot: A.Ivin - The Art of Right Thinking. Read this book first! She has nothing to do with programming, but her brains are very well tuned to the desired mode.

    Programming is like riding a bike. Do not be discouraged that once fell. You will not fall again. And I fall. But the more often you fall, the easier it is to climb and go farther.