主站
DreamJudge
院校信息
专业题库
模拟考试
机试真题
专业课程
讨论区
兑换中心
登录
注册
上岸
搜索
推 荐
择校分析
笔经面经
学习交流
我要提问
站内公告
调剂专题
精彩爆料
解题报告
P1565
SPFA
Sacan
SVIP
回复 2
|
赞 1
|
浏览 4.8k
#include <iostream> #include <queue> #define INF 1000000 using namespace std; int n,m; const int maxn = 105; // 图 int gra[...
P1003
c++
15240928957
回复 0
|
赞 0
|
浏览 112
#include <bits/stdc++.h> using namespace std; int fz(int n) { int w =0; while(n>0) &nb...
P1544
合并果子(C)
鱼翔浅底
回复 1
|
赞 0
|
浏览 8.5k
建立小顶堆,每次取出两个合并在放入堆中,直到合并成为一个 #include <stdio.h> #include <math.h> #include <stdlib.h> #include <string.h> #defin...
P1151
成绩排序 纯C题解另一思路(坚持使用qsort):
zxjrheaven
VIP
回复 0
|
赞 2
|
浏览 144
如果坚持使用qsort,就在结构体里另加一标记记录出现顺序,成绩相同时按顺序排序。 #include <stdio.h> #include <stdlib.h> typedef struct { char...
P1151
成绩排序 纯C题解:
zxjrheaven
VIP
回复 0
|
赞 1
|
浏览 201
关键在于排序的稳定性,C语言没有stable_sort,qsort不稳定,所以这里考虑的是牺牲复杂度,选择冒泡排序。 #include <stdio.h> #include <stdlib.h> #include <string.h&...
P1062
杨辉三角形 题解:
zxjrheaven
VIP
回复 0
|
赞 0
|
浏览 99
#include <stdio.h> //思路:定义一个大数组,第一列和对角线都1,然后从这两个线下面不是1的地方开始 //数等于上面的+左上的,就可以了。 int main() { int num[21][21]={0}; ...
P1102
素数判定 题解:为什么有错误啊佬们,dev c++能通过
2018024342
回复 5
|
赞 0
|
浏览 198
#include<bits/stdc++.h> using namespace std; int main(){ int a,b; while(scanf("%d %d",&am...
P1253
合唱队形 哪位大佬看看为什么只有50%:
Happy0111
回复 3
|
赞 0
|
浏览 175
/*找最高的同学为Ti,此时的值一定大于找其他同学的 然后去掉中间的同学从两边开始找, 最后结果是总人数-(两边加起来再加1)*/ #include<iostream> #include<algorithm> #include<strin...
P4215
二叉树的后序序列 题解:
honevid
VIP
回复 0
|
赞 0
|
浏览 154
看不懂下面的代码?我的CSDN博客有详细的代码过程分析,欢迎查看:【博客传送门】 #include <cstdio> #include <queue> #include <cmath> #include <cstring&g...
P2010
寻找二叉树的最后一层的最后一个结点 题解:
honevid
VIP
回复 0
|
赞 0
|
浏览 134
## 分析 - **注意第二个测试样例有毒,ABC##构不成先序序列,改成ABC####就好了** - 考察基本功,主要思路是根据带空树提醒的先序序列构建二叉树,然后输出层序遍历序列的最后一个元素 - 关于重建二叉树的思路可以参考我之前发的博文,链接如下: 【[6.二叉树—...
P4777
二叉树叶结点的个数 题解:
honevid
VIP
回复 0
|
赞 0
|
浏览 181
观察带空树表示的二叉树先序序列特点,每个结点顺序是根-左-右,那么就是说如果一个非空结点后面两个字符都是‘#’,那么这个结点肯定是树叶 #include <stdio.h> int main() { char str[1000]; w...
P1392
杨辉三角形 - 西北工业大学 题解:标准杨辉模版写一遍,然后从第二行开始输出即可
hccahhx
回复 0
|
赞 0
|
浏览 146
#include <bits/stdc++.h> using namespace std; int main(){ int a[100][100]={0}; int m; ...
P1256
拦截导弹 题解 nlongn方法:
Happy0111
回复 0
|
赞 0
|
浏览 117
#include<iostream> #include<algorithm> using namespace std; const int maxn=30; long long a[maxn]; long long dp[maxn]; ...
P1010
排序 题解:冒泡排序
Keving_CK
回复 0
|
赞 1
|
浏览 178
#include<stdio.h> //冒泡排序 void BSort(int A[],int n){ int temp; for(int i=0;i<n-1;i++){  ...
P1176
十进制和二进制 题解:
Kohi
VIP
回复 1
|
赞 0
|
浏览 390
#include <bits/stdc++.h> using namespace std; string division(string s, const int &from, const int &to, int &remain){ ...
P1478
喝饮料 题有没有佬给看看通过率为什么只有40
2018024342
回复 4
|
赞 0
|
浏览 237
#include <bits/stdc++.h> using namespace std; struct node{ double m,l; }p[1111]; bool cmp(node a,node b...
P1001
01序列 题解:利用bitset
RingoCrystal
回复 0
|
赞 0
|
浏览 171
#include <bits/stdc++.h> using namespace std; int main(){ for(int i=0;i<64;i++){ string str=bitset<6>(i).to_string(); ...
P1478
喝饮料 题解:每毫升的单价低者先喝
RingoCrystal
回复 0
|
赞 0
|
浏览 108
#include <bits/stdc++.h> using namespace std; struct node{ float mi; float wi; float good; node(float a,float b,float c){ mi...
P1296
括号匹配问题 题解:c++实现
Cookie‘s AE86
回复 1
|
赞 0
|
浏览 192
#include<bits/stdc++.h> using namespace std; struct node{ char data; int index; }; int main(){ ...
P1259
python求解
落翼
回复 1
|
赞 0
|
浏览 2.8k
通过python的int函数直接转换: while True: try: num = input() num = int(num, 16) print(num) except: break ...
P1422
进制转换3 题解:思想:m->10->n
中国人民万岁
回复 2
|
赞 0
|
浏览 253
#include <bits/stdc++.h> using namespace std; #define ll long long int val(char x) { if (x >= '0' &&a...
P1446
日期累加 题解:c++ 易于看懂 和 理解版本
damowanghwj
回复 0
|
赞 0
|
浏览 118
/*日期累加*/ #include<bits/stdc++.h> using namespace std; bool is_Leap(int year){//判断闰年 if(year % 400 == 0 || (year % 100 != 0 &&am...
P1846
天津大学-畅通工程 题解:
阿离
回复 0
|
赞 0
|
浏览 114
#include <bits/stdc++.h> using namespace std; const int maxn=1000+5; int fa[maxn]; int find(int x){ if(x==fa[x]) ...
P1838
南京理工-括号匹配 题解:使用stack 轻松解决
damowanghwj
回复 0
|
赞 0
|
浏览 121
#include<bits/stdc++.h> using namespace std; int GetPriority(char ch){ if(ch == '(' || ch == ')') return 1; if(ch == '<' || ...
P1838
南京理工-括号匹配 题解:map辅助判断
RingoCrystal
回复 0
|
赞 0
|
浏览 148
这个解法的本质其实很简单,这里提供一个例子来辅助大家理解 ({[)]为例,首先加入(,第一次判定为不等{加入,之后又不等[加入,)仍然不等加入,此时为({[),这时其实已经很显然了,对于左括号和不能正确匹配的右括号都采用跳过的方式,并不是直接就结束了,最后所以判断是否为空,对于正常的状态...
P1067
括号的匹配 题解:想问一下大佬为什么只能过20%
RingoCrystal
回复 1
|
赞 0
|
浏览 159
#include <bits/stdc++.h> using namespace std; int level(char a){ int level; if(a=='<')level=1; else if(a=='(')level=2...
P1000
C++
光明守护神
回复 0
|
赞 0
|
浏览 231
#include<bits/stdc++.h> using namespace std; int main() { auto a=1000000000*2; auto b=a; cin>>a>>b; cout<<a+...
P1051
日期计算 题解:只有50% 请问有什么问题吗
13729922474
回复 2
|
赞 0
|
浏览 188
#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <stdio.h> #include <string.h> #include <string> #include ...
P3501
回文数的判断 题解:
honevid
VIP
回复 0
|
赞 0
|
浏览 127
#include <cstdio> #include <queue> using namespace std; int main() { char num[5]; while (scanf("%s", num) != EOF) { get...
P1375
素数 题解:只能过83%
emperorT
回复 0
|
赞 0
|
浏览 152
#include<bits/stdc++.h> using namespace std; bool isPrime(int n){ if(n<=1){ return false; } fo...
1
...
3
4
5
6
7
...
127
我要提问
近期热门
1
N诺成就值出炉,帮你一眼识别大神
2
机试如何才能快速提高?
3
[置顶]计算机考研择校分析【25考研必读】
4
广度优先搜索计算每个人移动到每个位置需要去掉障碍物的最少数目,最后求和的最小值
5
1377旋转矩阵
6
ip地址(C)
7
简单易懂
8
C++递归解法,有注释
9
1017 幂次方 快速幂模板
10
计算机考研复试笔记——操作系统篇