diff --git a/Readme Generator/Assets/End.txt b/Readme Generator/Assets/End.txt new file mode 100644 index 0000000..8144351 --- /dev/null +++ b/Readme Generator/Assets/End.txt @@ -0,0 +1,9 @@ + + + + +## 🚀 About Me + +I am Shazid Mashrafi. +I am currently studying Computer Science and Engineering & trying to work my way up in the programming world. +Visit my [Website](https://shazidmashrafi.com) and [Codeforces](https://codeforces.com/profile/ShazidMashrafi) account. \ No newline at end of file diff --git a/Readme Generator/Assets/Start.txt b/Readme Generator/Assets/Start.txt new file mode 100644 index 0000000..4b19e73 --- /dev/null +++ b/Readme Generator/Assets/Start.txt @@ -0,0 +1,12 @@ +# Codeforces Solutions + +This repository contains my solutions of Codeforces problems. They are in C++ language. + +#### If this repository helped you out, please consider giving it a :star: + +
+ +## Index +#### Sorted by Problem ID +| Problem ID | Problem Name | Question | Solution | +| :--------: | :----------: | :------: | :------: | \ No newline at end of file diff --git a/Readme Generator/name_change.py b/Readme Generator/Assets/name_change.py similarity index 100% rename from Readme Generator/name_change.py rename to Readme Generator/Assets/name_change.py diff --git a/Readme Generator/Generate.py b/Readme Generator/Generate.py deleted file mode 100644 index dd25eaf..0000000 --- a/Readme Generator/Generate.py +++ /dev/null @@ -1,23 +0,0 @@ -import os - -folder_path = "D:\Programming\Problems solves\Codeforces\Codes" -output_file = "D:\Programming\Problems solves\Readme.txt" -qs = "[Question](https://codeforces.com/problemset/problem/" -sol = "[Solution](https://github.com/ShazidMashrafi/Codeforces-Solutions/tree/master/Experiment/" -space = "%20" - -folder_names = [str(folder_name) for folder_name in os.listdir(folder_path)] -entries = [] - -for folder_name in folder_names: - id, name = folder_name.split(' - ') - number, code = id.split(' ') - question_link = qs + number + "/" + code + ")" - solution_link = sol + number + space + code + space + '-' + space + name + ")" - entry = "| " + id + " | " + name + " | " + question_link + " | " + solution_link - entries.append(entry) - - - -with open(output_file, 'w') as file: - file.write('\n'.join(entries)) diff --git a/Readme Generator/Generator.py b/Readme Generator/Generator.py new file mode 100644 index 0000000..f4d8970 --- /dev/null +++ b/Readme Generator/Generator.py @@ -0,0 +1,38 @@ +import os + +folder_path = "D:\Programming\Problems solves\Codeforces\Codes" +output_file = "D:\Programming\Problems solves\Codeforces\Readme Generator\Readme.txt" + +qs = "[Question](https://codeforces.com/problemset/problem/" +sol = "[Solution](https://github.com/ShazidMashrafi/Codeforces-Solutions/tree/master/Codes/" +space = "%20" + +folder_names = [str(folder_name) for folder_name in os.listdir(folder_path)] +entries = [] + +for folder_name in folder_names: + Problem_id, Problem_name = folder_name.split(' - ') + number, code = Problem_id.split(' ') + name = Problem_name.replace(' ', space) + question_link = qs + number + "/" + code + ")" + solution_link = sol + number + space + code + space + '-' + space + name + ")" + entry = Problem_id + " | " + Problem_name + " | " + question_link + " | " + solution_link + entries.append(entry) + +entries.sort(key=lambda x: int(x.split(' ')[0])) + +Intro_file = "D:\Programming\Problems solves\Codeforces\Readme Generator\Assets\Start.txt" +About_file = "D:\Programming\Problems solves\Codeforces\Readme Generator\Assets\End.txt" + +with open(Intro_file, 'r') as start: + intro_lines = start.readlines() + +with open(About_file, 'r') as end: + about_lines = end.readlines() + +with open(output_file, 'w') as file: + file.write(''.join(intro_lines)) + file.write('\n| ') + file.write('\n| '.join(entries)) + file.write('\n') + file.write(''.join(about_lines))