-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Level 1 finished #1
Open
xenoppy
wants to merge
32
commits into
luckymark:master
Choose a base branch
from
xenoppy:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
94a14bb
Create runningLetter
xenoppy 60d13fe
Rename runningLetter to runningLetter.cpp
xenoppy 3c7488f
hello vscode
xenoppy 4dc3ae2
Diophantus_completed
xenoppy 0592d62
Diophantus_completed
xenoppy c3555d5
narcissus_completed
xenoppy 9bb62ad
allPrimes_primerly_completed
xenoppy 7f0ab39
p06_completed___p02_correct
xenoppy e5833d3
maze_completed
xenoppy 4caca54
maze_completed
xenoppy 7e7d3ec
hanoi_completed
xenoppy 56b8ae4
Merge branch 'master' of github.com:Y-saber-icarus-black-lotus/c2021
xenoppy b461115
encrypt_decrvpt_approaching_completed
xenoppy 9c5cb84
Nothing
xenoppy 831b1e0
Maze_based_on_dfs_completed
xenoppy 89a45c5
little_changes
xenoppy 6fb3ce6
temporary_storage
xenoppy e37dfd3
Delete .gitignore
xenoppy b5e2825
添加了gitignore
xenoppy f03ae7f
Merge branch 'master' of github.com:Y-saber-icarus-black-lotus/c2021
xenoppy 3670711
boxpusher_almost_completed
xenoppy 7d470ee
push_box_completed
xenoppy 931d50e
增加了一个地图文件
xenoppy 9462256
增加了说明信息
xenoppy 5978060
p12_warehouse_completed_including_a_examplified_file
xenoppy f52e334
p11_linkedList_completed
xenoppy d03cb10
p07_completed
xenoppy 7eac2a3
规范了格式,level1 已完成
xenoppy 29585be
修改了说明
xenoppy 5fd78a5
skiplist_finished
xenoppy b107e3e
已修改缩进问题
xenoppy a465ec4
已修改
xenoppy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#define WIDTH 60 | ||
#include <iostream> | ||
#include <string> | ||
#include <Windows.h> | ||
#include <stdio.h> | ||
using namespace std; | ||
int main() | ||
{ | ||
system("mode con cols=60 lines=1"); | ||
char c; | ||
string s; | ||
int n = 0, x = 0; | ||
cin >> s; | ||
int len = s.length(); | ||
while (true) | ||
{ | ||
system("mode con cols=60 lines=1"); | ||
for (int i = 0; i < n; i++) | ||
{ | ||
cout << ' '; | ||
} | ||
cout << s; | ||
Sleep(50); | ||
system("cls"); | ||
x = (x + 1) % (2 * (WIDTH - len)); | ||
n = (WIDTH - len - abs(x - WIDTH + len)); | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#define WIDTH 60 | ||
#include <iostream> | ||
#include <string> | ||
#include <Windows.h> | ||
#include <math.h> | ||
#include <stdio.h> | ||
using namespace std; | ||
bool judge(int n) | ||
{ | ||
if (n < 2) | ||
{ | ||
return false; | ||
} | ||
for (int i = 2; i <= sqrt(n); i++) | ||
{ | ||
if (n % i == 0) | ||
return false; | ||
} | ||
return false; | ||
} | ||
int main() | ||
{ | ||
int x; | ||
cin >> x; | ||
if (judge(x)) | ||
{ | ||
cout << "yes"; | ||
} | ||
else | ||
{ | ||
cout << "no" << endl; | ||
} | ||
system("pause"); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include<iostream> | ||
#include<math.h> | ||
#include<stdio.h> | ||
using namespace std; | ||
int main() { | ||
cout <<(5+4)/(1-1.0/6-1.0/12-1.0/7-1.0/2)-4 <<endl; | ||
system("pause"); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include <iostream> | ||
#include <math.h> | ||
#include <stdio.h> | ||
using namespace std; | ||
bool judge(int n) | ||
{ | ||
if (pow(n / 100, 3) + pow(n / 10 % 10, 3) + pow(n % 10, 3) == n) | ||
{ | ||
return true; | ||
} | ||
return false; | ||
} | ||
int main() | ||
{ | ||
for (int i = 100; i <= 999; i++) | ||
{ | ||
if (judge(i)) | ||
cout << i << endl; | ||
} | ||
system("pause"); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#include <iostream> | ||
#include <math.h> | ||
#include <stdio.h> | ||
#include <Windows.h> | ||
#include <time.h> | ||
using namespace std; | ||
int primes[170], pn = 1; | ||
bool judge(int n) | ||
{ | ||
if (n < 2) | ||
return false; | ||
for (int i = 0; i < pn; i++) | ||
{ | ||
if (n % primes[i] == 0) | ||
return false; | ||
if (primes[i] > sqrt(n)) | ||
return true; | ||
} | ||
return false; | ||
} | ||
int main() | ||
{ | ||
primes[0] = 2; | ||
DWORD start_time = GetTickCount(); | ||
int start_clock = clock(); | ||
cout << 2 << endl; | ||
for (int i = 3; i <= 1000; i = i + 2) | ||
{ | ||
if (judge(i)) | ||
{ | ||
cout << i << endl; | ||
primes[pn] = i; | ||
pn = pn + 1; | ||
} | ||
} | ||
DWORD end_time = GetTickCount(); | ||
int end_clock = clock(); | ||
cout << "time:" << end_time - start_time << endl; | ||
cout << "clock:" << end_clock - start_clock << endl; | ||
system("pause"); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#include <iostream> | ||
#include <math.h> | ||
#include <stdio.h> | ||
#include <Windows.h> | ||
#include <time.h> | ||
using namespace std; | ||
bool judge(int n) | ||
{ | ||
if (n < 2) | ||
{ | ||
return false; | ||
} | ||
for (int i = 2; i <= sqrt(n); i++) | ||
{ | ||
if (n % i == 0) | ||
{ | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
int main() | ||
{ | ||
for (int i = 4; i <= 100; i = i + 2) | ||
{ | ||
for (int j = 2; j < 100; j++) | ||
if (judge(j) && judge(i - j)) | ||
{ | ||
cout << i << "=" << j << "+" << i - j << endl; | ||
break; | ||
} | ||
} | ||
system("pause"); | ||
return 0; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
### 功能要求: | ||
|
||
1. 分别编写“加密”、“解密”函数,输入为任意长度的字符串 | ||
1. 分别编写“加密”、“解密”函数,输入为任意长度的字符串 | ||
|
||
注意:只针对小写字母进行加密 | ||
加密方法:记录小写字母的数据可用5位二进制表示,在末尾添一位随机数,然后分成三个二位,再和下一个(首尾相连)字母的前两位合并成一个四位二进制数,再在末尾添一位随机数,生成一个新的字符。 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
#include <iostream> | ||
#include <math.h> | ||
#include <stdio.h> | ||
#include <Windows.h> | ||
#include <string> | ||
#include <time.h> | ||
using namespace std; | ||
int group[1000][4]; | ||
int input[1000][3]; | ||
void decrypt() | ||
{ | ||
string s; | ||
cout << "please put in the contents you want to decrypt" << endl; | ||
cin >> s; | ||
unsigned j = 0; | ||
unsigned len = s.length(); | ||
for (unsigned i = 0; i < len; i = i + 3) | ||
{ | ||
char a = ((s[i] - 97) / 8) * 8 + ((s[i + 1] - 97) / 8) * 2 + ((s[i + 2] - 97) / 8) / 2 + 97; | ||
cout << a; | ||
} | ||
|
||
cout << endl; | ||
} | ||
void encrypt() | ||
{ | ||
srand(time(0)); | ||
string s; | ||
cout << "please put in the contents you want to encrypt" << endl; | ||
cin >> s; | ||
unsigned len = s.length(); | ||
for (unsigned i = 0; i < len; i++) | ||
{ | ||
srand((unsigned)time(NULL)); | ||
input[i][0] = (s[i] - 97) / 8; | ||
input[i][1] = ((s[i] - 97) / 2) % 4; | ||
input[i][2] = ((s[i] - 97) % 2) * 2 + rand() % 2; | ||
} | ||
for (unsigned i = 0; i < len; i = i + 1) | ||
{ | ||
srand((unsigned)time(NULL)); | ||
char a = input[i][0] * 8 + input[(i + 1) % len][0] * 2 + rand() % 2 + 97; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 重复的味道 |
||
char b = input[i][1] * 8 + input[(i + 1) % len][1] * 2 + rand() % 2 + 97; | ||
char c = input[i][2] * 8 + input[(i + 1) % len][2] * 2 + rand() % 2 + 97; | ||
|
||
cout << a; | ||
cout << b; | ||
cout << c; | ||
} | ||
cout << endl; | ||
system("pause"); | ||
} | ||
int main() | ||
{ | ||
cout << "encrypt or decrypt?" << endl | ||
<< "please put in E or D to choose the mode or put in e to exit the program" << endl; | ||
char c; | ||
cin >> c; | ||
switch (c) | ||
{ | ||
case 'E': | ||
{ | ||
encrypt(); | ||
break; | ||
} | ||
case 'D': | ||
{ | ||
decrypt(); | ||
break; | ||
} | ||
case 'e': | ||
break; | ||
default: | ||
cout << "??????????????????????" << endl | ||
<< "Please check!"; | ||
} | ||
system("pause"); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include <iostream> | ||
#include <math.h> | ||
#include <stdio.h> | ||
#include <Windows.h> | ||
#include <time.h> | ||
using namespace std; | ||
int hanoi(int n, int from, int goal, int temp) | ||
{ | ||
if (n != 1) | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 啊,是我没写清楚需求,要求打印出移动的步骤,例如: |
||
int a = hanoi(n - 1, from, temp, goal) + hanoi(1, from, goal, temp) + hanoi(n - 1, temp, goal, from) + 1; | ||
return a; | ||
} | ||
else | ||
cout << (char)(from + 65) << "->" << (char)(goal + 65) << endl; | ||
return 1; | ||
} | ||
int main() | ||
{ | ||
int n; | ||
cin >> n; | ||
cout << hanoi(n, 0, 2, 1) << endl; | ||
system("pause"); | ||
return 0; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
缩进不对,可以用IDE的自动format处理一下,vs、clion等IDE都有的
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
学到了!!!