11 2024 档案
摘要:#include<stdio.h> #include<stdlib.h> #include<string.h> #include<ctype.h> #define inf 0x3f3f3f typedef struct { char id[50]; char name[50]; char gende
阅读全文
摘要:Description 数据结构与算法实验题 Sins of a Solar EmpireP6 ★实验任务 正如你所知道的s_sin是一个贪玩的不得了的小P孩QAQ,你也知道他最近很喜欢玩一个叫做太阳帝国的原罪的策略游戏去年 他已经和疯狂的AI交战了整整一年。而现在,战斗的序幕又要拉开了。 在某个星
阅读全文
摘要:#include<iostream> #include<cstring> #include<algorithm> #include<queue> using namespace std; typedef pair<int, int>PII; const int N = 110; int n, m;
阅读全文
摘要:1 #include <stdio.h> #include <string.h> int main() { char* p1 = "12345", * p2 = p1; //允许! char* p3, p4[80]; //strcpy(p3,p1); 此时p3为野指针! p3 = "12345";
阅读全文
摘要:#include <stdio.h> void printBinary(unsigned int n) { int i; unsigned int mask = 1 << (sizeof(n) * 8 - 1); // 生成最高位的掩码 for (i = 0; i < sizeof(n) * 8;
阅读全文
摘要:下面有关数组的叙述中,只有( )是正确的: A)虽然不能对数组进行整体的赋值和IO等,但可以将整个数组作为参数传递给函数,函数也可以返回整个数组! B)C要求形参和相对应的实参都必须是类型相同的数组。 C)形参数组和实参数组为同一数组,共同拥有一段内存空间。 D)C语言规定数组名就是数组的首地址,但
阅读全文
摘要:c++能通过,c wrong #include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { int n; while (cin >> n) { vector<int> odd,
阅读全文
摘要:优先队列 用pair做优先队列priority_queue元素 简单讲解
阅读全文
摘要:都是用来字符串读一行 不同的是:fgets会自动添加换行符 很多字符串操作需要手动添加'\0' //处理方式 while (fgets(buf, sizeof(buf), stdin)) { // 移除末尾的换行符 换成结束符'\0' int len = strlen(buf); if (len =
阅读全文
摘要:二叉树的镜像 左右树互换 Tree dfs(Tree T) { if (T == NULL)return NULL; Tree tmp = T->Left; T->Left = dfs(T->Right); T->Right = dfs(tmp); return T; }
阅读全文
摘要:csdn 一个m*n的矩阵和一个n*p的矩阵相乘,将会得到一个m*p的矩阵 #include<iostream> #include<cstring> using namespace std; int main() { int a[110][110]={}; int b[110][110]={}; i
阅读全文
摘要:Description 索隆是有名的路痴,为了不让索隆走丢,娜美给了索隆一本地图。该地图有N个城市,编号从1到N。每个城 市有个代号,索隆每到一个城市只能知道该城市的代号而不知道该城市的编号,现有一份编号与代号对应的 清单,你能帮索隆尽快地找到所在城市的编号吗? Input 输入第一行为两个正整数N
阅读全文
摘要:第1题(教材第10章“编程练习”的第3题): #include <stdio.h> #define N 110 int a[N]; int main() { int maxx = -10000; int n; scanf("%d", &n); for (int i = 0; i < n; i++)
阅读全文
摘要:函数原型 下列程序输入3个整数(3个数之和不会超过整型数的最大值),计算并输出它们的平均值。下划线填入那个(些)行既不会导致编译错误也不会导致编译警告。 #include <stdio.h> ______________________________________________________
阅读全文
摘要:#include <stdio.h> int gcd(int a, int b) { if (a % b == 0) { return b; } else { return gcd(b, a % b); } } int main() { int num1, num2; printf("Enter f
阅读全文