NoobDream 首页 DreamJudge 院校信息 考研初试 机试真题 兑换中心
登录 注册 上岸
    推  荐 择校分析 笔经面经 学习交流 我要提问 站内公告 调剂专题 精彩爆料 解题报告
    头像
    P1348 百鸡问题 题解:
    leo110
    回复 0 | 赞 0 | 浏览 1
    #include<iostream> #include<vector> #include<algorithm> using namespace std; //提高时间复杂度的代价就是牺牲空间复杂度来排序  //加速为O(n2),不加速则是...
    头像
    P1294 后缀子串排序 题解:字符串切片+vector
    leo110
    回复 0 | 赞 0 | 浏览 10
    #include<iostream> #include<vector> #include<string> #include<algorithm> using namespace std; void StrSort(const str...
    头像
    P1000 A+B问题 题解:
    雨晴
    回复 0 | 赞 0 | 浏览 9
    A,B=map(int,input().split()) print(A+B)
    头像
    P2012 堆排序 题解:
    XCR553
    回复 0 | 赞 0 | 浏览 50
    #include <bits/stdc++.h> using namespace std; void adjustHeap(int* arr, int n, int i){     int mx = i;    &n...
    头像
    P1033 细菌的繁殖 题解:
    XCR553
    回复 0 | 赞 1 | 浏览 60
    什么动态规划,一个等差数列求和罢了,不知道其他题解搞那么复杂干什么 #include <bits/stdc++.h> using namespace std; int main() {     int N, n;  &nb...
    头像
    P1109 二叉树的建立和遍历 题解:只看题注,没看输出要求,所以把二叉树的相关功能几乎都写
    leo110
    回复 0 | 赞 0 | 浏览 120
    #include<iostream> #include<string> #include<queue> #include<vector> #include<algorithm> using namespace std; ...
    头像
    P1501 括号匹配 题解:
    leo110
    回复 0 | 赞 0 | 浏览 53
    //1067题的代码稍微改一点就行。主要两点不同:①只有两个类型的括号②括号没有优先级 //解题思路:map映射字符为整数,结合数据结构的stack进行括号匹配。  #include<iostream> #include<map> #include&l...
    头像
    P1067 括号的匹配 题解:"{{}}"这种平级括号内嵌也行!!!
    leo110
    回复 0 | 赞 0 | 浏览 84
    //解题思路:map映射字符为整数,结合数据结构的stack进行括号匹配。  #include<iostream> #include<map> #include<stack> using namespace std; map<c...
    头像
    P1161 二叉树遍历 题解:
    leo110
    回复 0 | 赞 1 | 浏览 39
    #include<iostream> using namespace std; typedef struct node{     char data;     struct node  *lchild...
    头像
    P1025 链表合并 题解:只为锻炼手搓链表以及合并链表,代码越长就越容易出一些小问题,因此
    leo110
    回复 0 | 赞 0 | 浏览 60
    #include<iostream> using namespace std; struct Node{     int data;     struct Node *next; }; struct N...
    头像
    P1022 删除最大最小数 题解:
    leo110
    回复 0 | 赞 0 | 浏览 59
    #include #include #include using namespace std; pair delemm(const vector& a){     int min= *min_element(a.begin(),a.end()...
    头像
    P1286 最短路径 题解:
    XCR553
    回复 1 | 赞 1 | 浏览 68
    Dijkstra+大数模拟 #include <bits/stdc++.h> using namespace std; struct Edge{     int u,v;     string w; }...
    头像
    P1085 校门外的树 题解:C语言求助
    josieisjose
    回复 0 | 赞 0 | 浏览 50
    #include <stdio.h> #include <stdlib.h> int compar(const void* a,const void* b) { return ((int**)a)[0]>((int**)b)[0]; } int mai...
    头像
    P1647 二进制6 题解:C++做法,使用bitset容器简化代码
    Jayho
    回复 0 | 赞 1 | 浏览 77
    #include<bits/stdc++.h> using namespace std; #define ll long long const unsigned ll MAXNUM = ((ll)1 << 32) - 1; int main() { in...
    头像
    P1500 求S(n) 题解:二项展开(3a+b)的5次幂对3的余=b的5次幂%3
    leo110
    回复 0 | 赞 0 | 浏览 70
    #include<iostream> #include<cmath> using namespace std; typedef long long ll; int main(){     ll n;  &nbs...
    头像
    P1344 最短路径问题 题解:
    XCR553
    回复 0 | 赞 0 | 浏览 51
    #include <bits/stdc++.h> using namespace std; struct Edge{     int u,v,w,c; }; struct Node{     int u...
    头像
    P1034 水仙花数 题解:
    leo110
    回复 0 | 赞 0 | 浏览 76
    #include<iostream> #include<cmath> using namespace std; int flag=0; void narcissus(int n){     int tmp=n,ans(0)...
    头像
    P1311 继续畅通工程 题解:prim算法
    Jayho
    回复 0 | 赞 1 | 浏览 89
    已经连通了的道路把权值设为0,意为不用再对此花费开销,在prim算法的正常处理过程中把这些边加入集合并累加权值时相当于进行一次空操作。 #include<bits/stdc++.h> using namespace std; int prim(vector<ve...
    头像
    P1051 日期计算 题解:先计算第几天然后判断输入合不合法
    leo110
    回复 0 | 赞 0 | 浏览 79
    #include<iostream> using namespace std; int f[13]={0,31,28,31,30,31,30,31,31,30,31,30,31}; struct date{     int year,m...
    头像
    P1473 字符棱形 题解:字符串切片解决
    leo110
    回复 0 | 赞 0 | 浏览 81
    #include<iostream> #include<iomanip> #include<string> using namespace std; string str="*******************************...
    头像
    P1422 进制转换3 题解:map+vector解决
    leo110
    回复 0 | 赞 2 | 浏览 93
    /*(1)没注意到提示里的要求字母输出小写,于是正确率只有60 (2)更正(1)后能达到80,但是翻来覆去没想到错误点在哪,可能这就是小会员的悲哀,看不到数据 最后死马当活马医改中间过渡变量tmp类型为longlong,以后整型数据一律定义为longlong了 解题思路:map字典,用字...
    头像
    P1551 判断二叉树是否对称 题解:
    yukina
    回复 0 | 赞 1 | 浏览 79
    //通过判断字符串对称性来解决 #include <iostream> #include <string> using namespace std; //检查对称性 bool checkSymmetry(string ss) {    ...
    头像
    P1009 随机数 题解:无语!一直以为求5位随机数的和与剩下15位的和
    leo110
    回复 0 | 赞 0 | 浏览 82
    #include<iostream> #include<time.h> using namespace std; int main(){     int a[21]={0},sum,index,count=0;  &...
    头像
    P1027 删除字符串2 题解:思路:先转换成小写,找到位置后把原字符串的对应位置置为空格,
    leo110
    回复 0 | 赞 0 | 浏览 97
    #include<iostream> #include<string> #include<vector> #include<sstream> using namespace std; //思路:先转换成小写,找到位置后把原字符串的对应位...
    头像
    P1012 字符移动 题解:利用两个char向量来完成
    leo110
    回复 0 | 赞 0 | 浏览 73
    #include<iostream> #include<string> #include<vector> #include<algorithm> using namespace std; int main(){  &nb...
    头像
    P5228 在树中找到父节点和子节点之和最大的节点 题解:
    snake
    回复 0 | 赞 0 | 浏览 72
    要解决这个问题,我们需要找到完全二叉树中满足条件的节点:该节点的值加上其父节点的值以及所有子节点的值之和最大。具体步骤如下: 理解完全二叉树的结构:完全二叉树可以用数组来表示,其中对于索引为i的节点(从0开始计数),其左子节点的索引为2i+1,右子节点的索引为2i+2,父节点...
    头像
    P5228 P5228 在树中找到父节点和子节点之和最大的节点 答疑提问:
    sjr
    回复 1 | 赞 2 | 浏览 129
    这个题的答案是不是有问题? 这怎么看答案都是2啊
    头像
    P1934 数字游戏 - 中南大学 题解:动态规划
    snake
    回复 0 | 赞 1 | 浏览 131
    这道题目要求我们找出使用给定数字(可以重复使用)凑出目标数m所需的最少数字数量。如果无法凑出目标数,则返回-1。这是一个典型的动态规划问题,类似于背包问题。 方法思路 问题分析:我们需要用最少的数字组合来达到目标数m。每个数字可以重复使用,类似于完全背包问题,但这里我们...
    头像
    P1015 单链表 题解:只为锻炼手搓单链表和相关功能
    leo110
    回复 0 | 赞 2 | 浏览 89
    #include<bits/stdc++.h> using namespace std; struct Node{     int Element;     struct Node *Next; }; ...
    头像
    P1091 促销计算 题解:
    18919717626
    回复 0 | 赞 0 | 浏览 95
    #include<bits/stdc++.h> using namespace std; signed main(){     int pay;     while(cin>>pay){  ...
    头像
    P1934 数字游戏 - 中南大学 题解:
    Jayho
    回复 0 | 赞 1 | 浏览 171
    感觉这道题有点问题,因为用贪心思想居然能过,以下是ac的贪心代码。但是当n=3,m=6,数组元素分别为3 4 5时,实际答案是2,但是用以下代码则输出-1。这道题的正解应该是dfs与动态规划。 #include<bits/stdc++.h> using namespac...
    头像
    P1882 表面积 题解:
    Jayho
    回复 0 | 赞 1 | 浏览 177
    根据此题可得出k个圆柱的最大可视面积为 (k个圆柱的侧面积之和+ k个圆柱中最大的一个圆柱的底面积 ),因此我们可以把圆柱数组按照侧面积降序排列,这样的话前k个圆柱的侧面积总和是最大的,此时可分为两种情况: ①把前k个圆柱的侧面积累加,再加上前k个之中最大的一个底面积,得到ans1; ...
    头像
    P5204 字符串的字典排序 题解:
    Verse Q
    回复 0 | 赞 0 | 浏览 148
    #include <iostream> #include <string> #include <algorithm> #include <vector> using namespace std; int main() { &n...
    头像
    P1011 日期 题解:
    iyishu
    回复 0 | 赞 0 | 浏览 176
    服了还考英语这题
    头像
    P2020 字符串转化 题解:
    故里526
    回复 0 | 赞 1 | 浏览 183
    #include<stdio.h> #include<string.h> int main(){ char a[100]; int i; int lenth; while(scanf("%s",a)!=EOF){ i...
    头像
    P1551 判断二叉树是否对称 题解:
    XCR553
    回复 0 | 赞 1 | 浏览 271
    //看了好几个都没有我的解法简单 #include <bits/stdc++.h> using namespace std; int main(){      string s;     &nb...
    头像
    P5104 约瑟夫问题的实现 题解:C语言实现
    Assassin123
    回复 0 | 赞 0 | 浏览 209
    #include "stdio.h" #include "stdlib.h" int main() { int n, k; scanf("%d %d", &n, &k); int flag1 = 0;//用于数k int ...
    头像
    P1035 简单背包问题 题解:
    机试过过过·
    回复 1 | 赞 4 | 浏览 281
    #include<bits/stdc++.h> // 包含标准库,方便使用各种功能 using namespace std; int main(){ int s, n; // 定义变量s表示背包的容量,n表示物品的数量 while(cin >&...
    头像
    P1125 求三角形的面积 题解:为啥过不去
    李志豪
    回复 1 | 赞 1 | 浏览 203
    #include<stdio.h> #include<math.h> int main(){     float x1,y1,x2,y2,x3,y3;     float s;   ...
    头像
    P5238 AB博弈 题解:
    知止而后动
    回复 0 | 赞 1 | 浏览 176
    这个问题类似于“拿石子游戏”,其中玩家每次可以拿1或2个石子,最后一个拿石子的人获胜。这种情况下,如果N是3的倍数,后手可以必胜;否则,先手可以必胜。
    头像
    P5244 数组划分 题解:
    fyy466
    回复 0 | 赞 1 | 浏览 234
    #include <stdio.h> #include <stdlib.h>   int max1(int i,int j,int* a ){ int max=0; for(int k=i;k<j;k++){ if(a[k]...
    头像
    P5244 数组划分 题解:
    fyy466
    回复 0 | 赞 0 | 浏览 227
    #include <stdio.h> #include <stdlib.h>   int max1(int i,int j,int* a ){ int max=0; for(int k=i;k<j;k++){ if(a[k]...
    头像
    P1020 最长连续因子 题解:使用一个长度量时刻记录,同时不停与最长变量对比
    AiLanKeSi
    回复 1 | 赞 19 | 浏览 495
    #include <stdio.h> int main() {     int length = 0;     int longest = 0;     int position...
    头像
    P1011 日期 题解:纯c
    李志豪
    回复 0 | 赞 6 | 浏览 311
    #include<stdio.h> void weeka(int m,int d){     int m_d[]={31,29,31,30,31,30,31,31,30,31,30,31};     int i; ...
    头像
    P1011 日期 题解:纯c
    李志豪
    回复 0 | 赞 2 | 浏览 251
    #include<stdio.h> void weeka(int m,int d){     int m_d[]={31,29,31,30,31,30,31,31,30,31,30,31};     int i; ...
    头像
    P1097 负二进制 题解:
    Jayho
    回复 0 | 赞 1 | 浏览 260
    暴力枚举 把一个变量从1开始递增,转化为二进制进行基数为-2的运算,所得结果与输入数比较。但是比较耗时。。。 #include<bits/stdc++.h> using namespace std; string judge(int n) {  &nbs...
    头像
    P1394 统计单词 题解:
    山崎友希
    回复 0 | 赞 5 | 浏览 292
    #include<stdio.h> #include<string.h> #define MAXSIZE 100 int main(){     char string[MAXSIZE];      ...
    头像
    P1580 一元三次方程求解 题解:
    山崎友希
    回复 0 | 赞 0 | 浏览 97
    #include<stdio.h> double a,b,c,d; double f(double x){     double result=a*x*x*x+b*x*x+c*x+d;     return...
    头像
    P1891 元数据 题解:
    山崎友希
    回复 0 | 赞 0 | 浏览 141
    #include<stdio.h> #include<string.h> #include<math.h> int main(){//那我问你,10的九次方是多少? //1000000000  确实 这就是10的9次方 //10000...
    头像
    P2015 涂颜色 题解:
    DASH106
    回复 0 | 赞 2 | 浏览 228
    #include <bits/stdc++.h> using namespace std; typedef long long ll; ll string_mod(const string&s,ll mod){     ll res = ...
    • 1
    • 2
我要提问
全站热榜
1 无法正确通过题目都是哪些原因造成的?
2 机试如何才能快速提高?
3 题目难点:数学公式不断化解
4 [置顶]计算机考研择校分析【25考研必读】
5 逻辑很简单,但是实现却要小心多多
6 A+B问题 题解:C
7 1017 幂次方 快速幂模板
8 广度优先搜索计算每个人移动到每个位置需要去掉障碍物的最少数目,最后求和的最小值
9 日期 题解:
10 负二进制 题解:
关于我们 加入我们 友情链接
NoobDream       The road of your choice, you have to go on !       粤ICP备16082171号-1

哔哩哔哩

官方微信

官方微博