[Life Course] My Creation Anniversary

Table of contents

A love-hate relationship with programming

The harvest in csdn:

Daily life with csdn

An occasional sense of accomplishment on an ordinary day:

Vision for the future:


Today is 2023.4.8. I just finished participating in the Blue Bridge Cup in the morning. I saw the official csdn event in the afternoon. I wrote the following content on a whim. Please forgive me if there is any discomfort or error.


A love-hate relationship with programming

In 2021, I successfully got rid of my status as a high school student, and I became a college student! 

When I was a freshman, I majored in mechanical design, manufacturing and automation. In the first semester of my freshman year, I accidentally learned the C language. At that time, I thought programming was very interesting. There are many people in the major of machinery. It appeared, so I tried to sign up, but I didn't expect to transfer directly to the software engineering major and become a professional.

Discuss the solution and optimization of the problem with good friends:

 We often discuss the solution and optimization of the problem together, and sometimes participate in activities together, chat and discuss problems.


The harvest in csdn:

I have written a blog on csdn for more than half a year, met many bigwigs and like-minded friends, and gained many fans

 In several blogs, many people have also received recognition and reading


Daily life with csdn

Writing blogs on csdn actually takes a lot of time. I have thought about a question before: Is there a conflict between learning and updating blogs, and the time seems to be insufficient?

After I wrote a blog, I found that in the process of blogging, you need to consider the logic and framework of your thinking, so that others can understand (in fact, most of them are for yourself, review, etc.), so you finish blogging , you will have a better understanding of knowledge.

Therefore, I think blogging itself is a way of learning, and there is no conflict.


An occasional sense of accomplishment on an ordinary day:

I recently wrote a topic that gave me a sense of accomplishment: (It may be very simple for the boss, but I still have a sense of accomplishment for me at that time, don’t spray it, thank you!!!)

Jumping on the Slate

#include<iostream>
#include<vector>
#include<cmath>
using namespace std;
int StepNum(int n, int m)
{
    vector<int>step(m + 1, 0);
    step[n] = 1;//先加了一步,后面得-1;
    for (int i = n; i < m; i++)
    {
        vector<int>div;
        if (step[i] == 0)continue;
        //因为我们之前给步数加了约数,这个就是找到下一个不为0的位置(也就是之前步数+约数=新步数的位置)

        for (int j = 2; j <= sqrt(i); j++)
        {//计算每个i的约数
            if (i % j == 0)
            {
                div.push_back(j);
                if (i / j != j)
                    div.push_back(i / j);
            }
        }

        for (int j = 0; j < div.size(); j++)
        {
            if (div[j] + i <= m && step[i + div[j]] != 0)
                step[div[j] + i] = min(step[div[j] + i], step[i] + 1);
            else if (div[j] + i <= m)step[div[j] + i] = step[i] + 1;
            //如果div[j]+i(约数+下标等于下一个的下标
            // 如果step【下一个下标】等于0,就step【下一个下标】=当前步数+1
            //如果不为1,取他们的最小值
        }
    }

    if (step[m] == 0)
        return -1;
    else
        return step[m] - 1;
}
int main()
{
    int n, m;
    cin >> n >> m;
    cout << StepNum(n, m) << endl;
    return 0;
}

Vision for the future:

  • Now I am in the laboratory of our school teacher, and I hope that I can get good results in the competitions I will participate in later
  • I am learning C++ and Linux now, but the game industry is more attractive to me. I may learn related knowledge in the future, and I hope to be able to work in C++ or games in the future.

Guess you like

Origin blog.csdn.net/m0_69061857/article/details/130031814