Capricornian's blog

By Capricornian, history, 5 years ago, In English

Hello, I'm Capricornian. I have a problem, which seems to be easy, but I have no idea how to achieve a solution of that problem in approriate time limit.

Can you help me to figure it out and find how it works?

This is the problem statement:

Number Distribution

Giving two integers A and B (A and B is in range [0..2E9]) and a non-negative integer T < 1E18.

In one operation, this rule is followed :

if (A < B) B = B - A, A = 2 * A, ;
else A = A - B, B = 2 * B;

Calculate A and B after T operations. (I have figured out that if you do these sequences of operation enough times, you will get back A and B in the beginning case, but I can't find the rule behind that).

Thanks for helping !

Capricornian.

Full text and comments »

  • Vote: I like it
  • +11
  • Vote: I do not like it

By Capricornian, history, 5 years ago, In English

Hello everyone, I'm Capricornian, and I'm using VS Code to code and build my CP submissions.

I'm now using a debug template and stderr for debugging. But I really want to debug my C++ program with GDB for better performance. (I'm using GNU GCC 8.1.0 (MinGW))

And when I try to configure GDB to use on VS Code, I found a very tricky problem, which I try to solve it for many days but it didn't work at all.

On VS Code, you have to configure .vscode folder, which contains 2 most important files launch.json, tasks.json so you can build and debug the program. And here is my launch.json and tasks.json :

(You can see my compiler path inside this file, and you can change it to test on your local computer).

https://pastebin.com/4ddJ4se1 : tasks.json

https://pastebin.com/vM8TkX9X : launch.json

It may looks good and works perfectly, but when I start debugging my program using F5, then VS Code just build my source code (so I have a .exe file) and after that, the PowerShell pops up and try to start a debug process, and then, the process stucked, and I can't debug anything.

I have tried many ways, searched for many websites and applied many fixes, but it still get stucked.

So, please, I need you test these files and please help me find a problem, or show me how did you configure C++ build and debug process in VS Code with no problem.

I will give everything you need to help me solve this mess, so just ask me in the comment section below, I will try to answer ASAP.

I will be very pleased if anyone can help me solve this tricky problem, and thank you very much for that effort.

Best regard,

Capricornian

UPD: Here are the screenshots of my problem

My build process (successful)

My debug process (failed, and it keeps getting this state for 2 minutes, then I turn off)

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it