-
Notifications
You must be signed in to change notification settings - Fork 35
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
陈小羽 homework #47
Open
chenxiaoyu233
wants to merge
71
commits into
luckymark:master
Choose a base branch
from
chenxiaoyu233: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
陈小羽 homework #47
Changes from 28 commits
Commits
Show all changes
71 commits
Select commit
Hold shift + click to select a range
9bd1315
v1
jianx312035 bbc8b00
c/C1/1
jianx312035 996decf
c/c0/2
jianx312035 d41f6f7
c/level0/c1/3
jianx312035 decfc01
running letter
jianx312035 83529ff
running letter -- written on Unix
jianx312035 1276962
p02_isPrime --written on Unix
jianx312035 1645250
p03_Diophantus --written on Unix
jianx312035 2dc692e
p04_ narcissus --written on Unix
jianx312035 cab536b
p05_allPrimes --written on Unix
jianx312035 4fd5790
p05_allPrimes --written on Unix
jianx312035 8acfefa
p06_Goldbach --written on Unix
jianx312035 d248dad
p07_encrypt_decrypt --written on Unix
jianx312035 2fa8677
p08_hanoi --written on Unix
jianx312035 552eebc
p01_Queue --written on Unix
jianx312035 79cde06
p09_maze --written on Unix
chenxiaoyu233 d6bab51
p09_maze --alpha --witten on Unix
jianx312035 2da4d83
p10_pushBoxes --written on Unix
jianx312035 286b3ae
p11_linkedList --written on Unix
jianx312035 28becc8
p12_warehouse --written on Unix
jianx312035 6b1bd16
change p01->p08 with c language --written on Unix
jianx312035 3999787
p11_warehouse --v1.1 --written on Unix
jianx312035 ac06a56
remove trash
jianx312035 2946e7c
level02-GA algorithm -- written on Unix
jianx312035 2bc4abd
move trash
jianx312035 863d416
c++ p01_Queue --written on Unix
jianx312035 c03b1b5
c++ p02_Stack -changeable length --written on Unix
jianx312035 5d3e9eb
c++ p03_SafeArray --written on Unix
jianx312035 af601e3
c++/p04 --written on unix
jianx312035 69377b0
c++/p06 --written on unix
jianx312035 fac8ff3
adjust of tabstop
jianx312035 97c31de
adjust according to suggestions
jianx312035 3f046be
p04 --Update Todolist
jianx312035 f3451e9
c++/p05-canvas --written on unix
jianx312035 c1622d6
c++/p07_circuit --written on Unix
jianx312035 2709016
c++/p02_stack --add template
jianx312035 a3f0f90
c++/p03-SafeArray --add template
jianx312035 82993b7
c++/p11_fighter --environment
jianx312035 0d43ef0
c++/p11_Fighter Basic_classes
jianx312035 7d87e62
c++/Fighter shot
jianx312035 b26e67e
c++/Fighter sf::Sound 全局bug修复
jianx312035 31cdd12
c++/p11_Fighter 添加背景和边界检测和子弹消亡动画
jianx312035 7434de9
c++/p11_Fighter 子弹声音bug修复
jianx312035 6da6cbf
c++/p11_fighter 代码整理
jianx312035 a910d10
c++/p11_fighter Enemy added
jianx312035 58cf0d9
c++/fighter 素材
jianx312035 4137b19
c++/fighter 物理引擎添加
jianx312035 c45a78c
c++/fighter 导演类翻新+代码整理
jianx312035 448a39c
c++/fighter 枚举代替数字
jianx312035 25565ac
c++/fighter 子弹物理效果
jianx312035 17694ab
c++/fighter Q技能添加+碰撞系统完善+主边界线+物件之间关系
jianx312035 3c8c36a
c++/fighter 清理sfml库文件安装包
jianx312035 955f1af
c++/fighter 清理sfml库文件
jianx312035 40e0abf
c++/p11_fighter 添加背景图片,修正技能释放效果
jianx312035 e0e6ad1
c++/p11_fighter 添加敌机子弹,影响
jianx312035 966c21c
c++/p11_figther 添加完全弹性碰撞效果
jianx312035 616df11
c++/p11_fighter 添加gal元素,修正物理类bug
jianx312035 9fc8716
c++/p11_fighter 添加CG类,炫酷,使用新方法对齐动画时间
jianx312035 4377690
c++/p11_fighter 添加作者名,添加了一些素材,修正了动画更新
jianx312035 f0f4993
c++/p11_fighter 添加新技能
jianx312035 ca22250
c++/p11_fighter 添加背景音乐
jianx312035 0187b0e
c++/p11_fighter 添加地图切换,过关控制
jianx312035 bc21172
c++/p11_fighter 添加敌机死亡动画,门的通过控制
jianx312035 461dca2
c++/p11_fighter 添加地图,胜利判断
jianx312035 488e21e
c++/p11_fighter 收尾工作
jianx312035 9d422a6
c++/p11_fighter 基本收工
jianx312035 c19d775
c++/p11_fighter 重大bug修复
jianx312035 029108e
c++/p11_fighter 添加帧率检测
jianx312035 b361c5a
c++/p08_EmployeeAndSales finish
jianx312035 766a455
c++/p09_Tree finish
jianx312035 88c07c0
c++/p10_Iterator finish
jianx312035 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 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,6 @@ | ||
//测试一下git | ||
#include <stdio.h> | ||
int main(){ | ||
printf("Hello World I'm Chenxiaoyu\n"); | ||
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,2 @@ | ||
main: 1.c | ||
cc 1.c |
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,17 @@ | ||
#include <stdio.h> | ||
#include <string.h> | ||
char ans1[3][10] = {"正数","负数","0"}; | ||
char ans2[2][10] = {"奇数","偶数"}; | ||
char *ans[2]; | ||
int sgn(int n){ | ||
if(n == 0) return 2; | ||
return n > 0 ? 0 : 1; | ||
} | ||
int main(){ | ||
int n; | ||
scanf(" %d",&n); | ||
ans[0] = ans1[sgn(n)]; | ||
ans[1] = n % 2 ? ans2[0] : ans2[1]; | ||
printf("%s %s", ans[0], ans[1]); | ||
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,7 @@ | ||
#include <stdio.h> | ||
int main(){ | ||
int n; | ||
scanf(" %d", &n); | ||
printf("%s\n",(n % 13 == 0 ? "YES" : "NO")); | ||
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,8 @@ | ||
#include <stdio.h> | ||
int main(){ | ||
int n; | ||
scanf(" %d",&n); | ||
printf("%s\n",( n % 4 == 0 && n % 100 != 0) || (n % 400 == 0) ? "YES" : "NO"); | ||
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,6 @@ | ||
my1: 1.c | ||
cc 1.c | ||
my2: 2.c | ||
cc 2.c | ||
my3: 3.c | ||
cc 3.c |
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,2 @@ | ||
main: my.c | ||
cc -lcurses my.c -g -o my.c.out |
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,24 @@ | ||
//written on unix | ||
#include <stdio.h> | ||
#include <curses.h> | ||
void delay(){ | ||
for(int i = 1; i <= 50000000; i++); | ||
} | ||
int main(){ | ||
initscr(); | ||
int pos = 0,dir = 1; | ||
while(1){ | ||
int col = COLS - 1; | ||
mvaddch(0,pos,'R'); | ||
refresh(); | ||
delay(); | ||
if(pos == 0) | ||
dir = 1; | ||
if(pos == col) | ||
dir = -1; | ||
mvaddch(0,pos,' '); | ||
pos += dir; | ||
} | ||
endwin(); | ||
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,2 @@ | ||
main: my.c | ||
cc my.c -o my.c.out -g |
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,14 @@ | ||
#include <string.h> | ||
#include <stdio.h> | ||
int main(){ | ||
int n; | ||
scanf("%d",&n); | ||
int flag = 1; | ||
for(int i = 2; i*i <= n; i++) | ||
if(n % i == 0){ | ||
flag = 0; | ||
break; | ||
} | ||
printf("%s\n",(flag == 1 ? "YES" : "NO")); | ||
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 <stdio.h> | ||
int main(){ | ||
for(int i = 0; i <= 200; i+=7*12){ | ||
if(2 * ( (i - 4) - (i / 7 + i / 6 + i / 12 + 5)) == i){ | ||
printf("%d\n", i - 4); | ||
} | ||
} | ||
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,12 @@ | ||
#include <stdio.h> | ||
int pow_3(int x){ | ||
return x * x * x; | ||
} | ||
int main(){ | ||
for(int i = 100; i <= 999; i++){ | ||
int cur = pow_3( i % 10 ) + pow_3( (i/10) % 10 ) + pow_3( i / 100 ); | ||
if(cur == i) | ||
printf("%d\n", i); | ||
} | ||
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,40 @@ | ||
//#include <cstring> | ||
#include <cstdio> | ||
#include <sys/time.h> | ||
//#include <numeric> | ||
//#include <chrono> | ||
#define maxn 2005 | ||
//using namespace std; | ||
int prime[maxn]; | ||
int not_prime[maxn]; | ||
int cnt_prime; | ||
void get_prime(){ | ||
for(int i = 2; i <= 2000; i++){ | ||
if(!not_prime[i]) prime[++cnt_prime] = i; | ||
for(int j = 1; j <= cnt_prime; j++){ | ||
if(i * prime[j] > 2000) break; | ||
not_prime[i * prime[j]] = 1; | ||
if(i % prime[j] == 0) break; | ||
} | ||
} | ||
} | ||
void work(){ | ||
get_prime(); | ||
for(int i = 1; i <= cnt_prime; i++){ | ||
printf("%d ",prime[i]); | ||
} | ||
printf("\n"); | ||
} | ||
int main(){ | ||
struct timeval start, end; | ||
gettimeofday( &start, NULL ); | ||
|
||
work(); | ||
|
||
gettimeofday( &end, NULL ); | ||
float timeuse = 1e6 * (end.tv_sec - start.tv_sec) + end.tv_usec - start.tv_usec; | ||
timeuse *= 1e-6; | ||
printf("Total time: %f\n", timeuse); | ||
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,33 @@ | ||
#include <string.h> | ||
#include <stdio.h> | ||
#define maxn 105 | ||
int prime[maxn]; | ||
int not_prime[maxn]; | ||
int cnt_prime; | ||
void get_prime(){ | ||
for(int i = 2; i <= 100; i++){ | ||
if(!not_prime[i]) prime[++cnt_prime] = i; | ||
for(int j = 1; j <= cnt_prime; j++){ | ||
if(i * prime[j] > 100) break; | ||
not_prime[i * prime[j]] = 1; | ||
if(i % prime[j] == 0) break; | ||
} | ||
} | ||
} | ||
int main(){ | ||
get_prime(); | ||
int flag = 1; | ||
for(int i = 4; i <= 100; i += 2){ | ||
int cur = 0; | ||
for(int j = 2; j <= i-2; j++) if(!not_prime[j] && !not_prime[i-j]){ | ||
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. 不要把 if和for循环写到一行上 |
||
//cout << j << " " << i-j << endl; | ||
//printf("%d %d",i,i-j); | ||
cur = 1; break; | ||
} | ||
if(cur == 0){ | ||
flag = 0; break; | ||
} | ||
} | ||
printf("%s\n", (flag == 1 ? "right" : "wrong") ); | ||
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,41 @@ | ||
/* useage */ | ||
/* whe you use encrypt, the program will return you a seed, and you should use the seed to decrypt the code */ | ||
/* example: | ||
$./my.cpp.out encrypt abcde | ||
WXYZ[ 10 | ||
$./my.cpp.out decrypt WXYZ[ 10 | ||
abcde | ||
*/ | ||
#include <string.h> | ||
#include <stdio.h> | ||
#include <time.h> | ||
#include <stdlib.h> | ||
void en(char s[]){ | ||
int len = strlen(s); | ||
int now = rand() % 30; | ||
for(int i = 0; i < len; i++){ | ||
//cout << (char)(s[i] - now); | ||
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. 这些输出语句,是为了debug吧? 建议还是先学会debug的工具为好;不过看你用的make来编译的,很厉害!如果不用IDE的话,貌似只能用gdb了,这个有些难度,也可以玩玩看 |
||
printf("%c", (char) (s[i] - now)); | ||
} | ||
//cout << " " << now << endl; | ||
printf(" %d%d\n", now/10,now%10); | ||
//cout << endl; | ||
} | ||
void de(char s[],char ti[]){ | ||
int len = strlen(s); | ||
int now = 10 * (ti[0] - '0') + ti[1] - '0'; | ||
for(int i = 0; i < len; i++){ | ||
//cout << (char)(s[i] + now); | ||
printf("%c", (char) (s[i] + now) ); | ||
} | ||
//cout << endl; | ||
printf("\n"); | ||
} | ||
int main(int argc,char *argv[]){ | ||
srand(time(NULL)); | ||
if(argv[1][0] == 'e') | ||
en(argv[2]); | ||
else | ||
de(argv[2],argv[3]); | ||
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,18 @@ | ||
//this program will print the solution of hanoi of n discs | ||
#include <stdio.h> | ||
#include <string.h> | ||
void dfs(int num,int a,int b,int c){ | ||
if(num == 1){ | ||
printf("%d -> %d\n", a,c); | ||
return; | ||
} | ||
dfs(num-1,a,c,b); | ||
dfs(1,a,b,c); | ||
dfs(num-1,b,a,c); | ||
} | ||
int main(){ | ||
int n; | ||
scanf("%d",&n); | ||
dfs(n,1,2,3); | ||
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,2 @@ | ||
main: my.c | ||
cc -lcurses -g -o my.c.out my.c |
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,18 @@ | ||
17 47 | ||
############################################### | ||
############################################### | ||
#### $############################ | ||
#### ######## ############## ######## | ||
#### ######## #### ######### ######## | ||
#### ####### ############## # # ######## | ||
#### #### ############### # ##### # ######## | ||
####### #### ### # @# # ######## | ||
####### #### ######## ###### ####### # ######## | ||
####### ####### ###### # ######## | ||
############# ####### ################ ######## | ||
##################### ######## | ||
##################### ######################### | ||
############# ######################### | ||
############################################### | ||
############################################### | ||
############################################### |
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,19 @@ | ||
18 45 | ||
############################################# | ||
############ ##### ################## | ||
############ ############# ################## | ||
############ ## # ################## | ||
############ ## ########## # ######### | ||
############ ## #* ##### ######## ######### | ||
############ ## #### ##### #% # ######### | ||
############ ## #### ##### ### #### ######### | ||
############ ## # ##### ### #### ######### | ||
############ ## #### ##### ### #### ######### | ||
############### #### ##### ### #### ######### | ||
#################### ##### ### #### ######### | ||
###### *# ##### # @# ######### | ||
###### ############# ##### ######## ######### | ||
###### #############%##### ######### | ||
###### ###################################### | ||
######^###################################### | ||
# # |
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.
为什么缩进这么多? 本来准备放你一马,结果看到后面,实在是受不了了 😄