摘要: B-Knight Moves POJ 1915 题目大意 给定一个骑士(马)在棋盘上的起点和终点,输出需要移动的最小步数。如果起始点和终点相同,则输出 0。 分析 BFS,向8种走位搜索,搜到就行了。 代码 #include<stdio.h> #include<queue> using namesp 阅读全文
posted @ 2022-01-22 23:29 Konpakuy 阅读(33) 评论(0) 推荐(0) 编辑
摘要: #实验任务1 #include <stdio.h> #define N 5 // 定义结构体类型struct student,并定义STU为其别名 typedef struct student { long no; char name[20]; int score; } STU; // 函数声明 v 阅读全文
posted @ 2021-12-28 19:11 Konpakuy 阅读(50) 评论(1) 推荐(0) 编辑
摘要: 实验任务1 #include <stdio.h> #define N 5 int binarySearch(int *x, int n, int item); // 函数声明 int main() { int a[N] = {2, 7, 19, 45, 66}; int i, index, key; 阅读全文
posted @ 2021-12-15 11:01 Konpakuy 阅读(49) 评论(2) 推荐(1) 编辑
摘要: 2021-12-9 #实验任务1 ##1.1 #include <stdio.h> #define N 5 void output(int x[], int n); int main() { int x[N] = {9, 55, 30, 27, 22}; int i; int k; // 用于记录最 阅读全文
posted @ 2021-12-09 23:54 Konpakuy 阅读(38) 评论(1) 推荐(0) 编辑
摘要: #任务1 ##task1.1 #include<stdio.h> const int N = 4; int main() { int a[N] ={2, 0, 2, 1}; char b[N] = {'2','0','1','1'}; int i; printf("sizeof(int) = %d\ 阅读全文
posted @ 2021-12-01 11:32 Konpakuy 阅读(96) 评论(2) 推荐(0) 编辑
摘要: 实验任务1 1 #include<stdio.h> 2 long long fac(int n); 3 int main(){ 4 int i,n; 5 printf("Enter n: "); 6 scanf("%d",&n); 7 8 for (i=1;i<=n;i++){ 9 printf(" 阅读全文
posted @ 2021-11-24 11:34 Konpakuy 阅读(54) 评论(3) 推荐(0) 编辑
摘要: >老师的任务罢了 # 实验任务1 #include<stdio.h> int main () { int num; scanf("%d", &num); printf("2049%04d\n", num); scanf("%d", &num); printf("2049%04d\n", num); 阅读全文
posted @ 2021-11-11 17:49 Konpakuy 阅读(67) 评论(3) 推荐(0) 编辑
摘要: 实验任务1 //打印一个字符小人 #include<stdio.h> int main() { printf(" o \t o\n"); printf("<H> \t <H>\n"); printf("I I \t I I\n"); } #include<stdio.h> int main() { 阅读全文
posted @ 2021-10-29 22:56 Konpakuy 阅读(27) 评论(0) 推荐(0) 编辑