首页
DreamJudge
院校信息
考研初试
机试真题
讨论区
兑换中心
登录
注册
上岸
搜索
推 荐
择校分析
笔经面经
学习交流
我要提问
站内公告
调剂专题
精彩爆料
解题报告
P1085
校门外的树 题解:C语言求助
josieisjose
回复 0
|
赞 0
#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
#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
#include<iostream> #include<cmath> using namespace std; typedef long long ll; int main(){ ll n; &nbs...
P1344
最短路径问题 题解:
XCR553
回复 0
|
赞 0
#include <bits/stdc++.h> using namespace std; struct Edge{ int u,v,w,c; }; struct Node{ int u...
P1034
水仙花数 题解:
leo110
回复 0
|
赞 0
#include<iostream> #include<cmath> using namespace std; int flag=0; void narcissus(int n){ int tmp=n,ans(0)...
P1311
继续畅通工程 题解:prim算法
Jayho
回复 0
|
赞 1
已经连通了的道路把权值设为0,意为不用再对此花费开销,在prim算法的正常处理过程中把这些边加入集合并累加权值时相当于进行一次空操作。 #include<bits/stdc++.h> using namespace std; int prim(vector<ve...
P1051
日期计算 题解:先计算第几天然后判断输入合不合法
leo110
回复 0
|
赞 0
#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
#include<iostream> #include<iomanip> #include<string> using namespace std; string str="*******************************...
P1422
进制转换3 题解:map+vector解决
leo110
回复 0
|
赞 2
/*(1)没注意到提示里的要求字母输出小写,于是正确率只有60 (2)更正(1)后能达到80,但是翻来覆去没想到错误点在哪,可能这就是小会员的悲哀,看不到数据 最后死马当活马医改中间过渡变量tmp类型为longlong,以后整型数据一律定义为longlong了 解题思路:map字典,用字...
P1551
判断二叉树是否对称 题解:
yukina
回复 0
|
赞 1
//通过判断字符串对称性来解决 #include <iostream> #include <string> using namespace std; //检查对称性 bool checkSymmetry(string ss) {  ...
P1009
随机数 题解:无语!一直以为求5位随机数的和与剩下15位的和
leo110
回复 0
|
赞 0
#include<iostream> #include<time.h> using namespace std; int main(){ int a[21]={0},sum,index,count=0; &...
P1027
删除字符串2 题解:思路:先转换成小写,找到位置后把原字符串的对应位置置为空格,
leo110
回复 0
|
赞 0
#include<iostream> #include<string> #include<vector> #include<sstream> using namespace std; //思路:先转换成小写,找到位置后把原字符串的对应位...
P1012
字符移动 题解:利用两个char向量来完成
leo110
回复 0
|
赞 1
#include<iostream> #include<string> #include<vector> #include<algorithm> using namespace std; int main(){ &nb...
P5228
在树中找到父节点和子节点之和最大的节点 题解:
snake
回复 0
|
赞 0
要解决这个问题,我们需要找到完全二叉树中满足条件的节点:该节点的值加上其父节点的值以及所有子节点的值之和最大。具体步骤如下: 理解完全二叉树的结构:完全二叉树可以用数组来表示,其中对于索引为i的节点(从0开始计数),其左子节点的索引为2i+1,右子节点的索引为2i+2,父节点...
P5228
P5228 在树中找到父节点和子节点之和最大的节点 答疑提问:
sjr
回复 1
|
赞 3
这个题的答案是不是有问题? 这怎么看答案都是2啊
P1934
数字游戏 - 中南大学 题解:动态规划
snake
回复 0
|
赞 1
这道题目要求我们找出使用给定数字(可以重复使用)凑出目标数m所需的最少数字数量。如果无法凑出目标数,则返回-1。这是一个典型的动态规划问题,类似于背包问题。 方法思路 问题分析:我们需要用最少的数字组合来达到目标数m。每个数字可以重复使用,类似于完全背包问题,但这里我们...
P1015
单链表 题解:只为锻炼手搓单链表和相关功能
leo110
回复 0
|
赞 2
#include<bits/stdc++.h> using namespace std; struct Node{ int Element; struct Node *Next; }; ...
P1091
促销计算 题解:
18919717626
回复 0
|
赞 1
#include<bits/stdc++.h> using namespace std; signed main(){ int pay; while(cin>>pay){ ...
P1934
数字游戏 - 中南大学 题解:
Jayho
回复 0
|
赞 1
感觉这道题有点问题,因为用贪心思想居然能过,以下是ac的贪心代码。但是当n=3,m=6,数组元素分别为3 4 5时,实际答案是2,但是用以下代码则输出-1。这道题的正解应该是dfs与动态规划。 #include<bits/stdc++.h> using namespac...
P1882
表面积 题解:
Jayho
回复 0
|
赞 1
根据此题可得出k个圆柱的最大可视面积为 (k个圆柱的侧面积之和+ k个圆柱中最大的一个圆柱的底面积 ),因此我们可以把圆柱数组按照侧面积降序排列,这样的话前k个圆柱的侧面积总和是最大的,此时可分为两种情况: ①把前k个圆柱的侧面积累加,再加上前k个之中最大的一个底面积,得到ans1; ...
P5204
字符串的字典排序 题解:
Verse Q
回复 0
|
赞 0
#include <iostream> #include <string> #include <algorithm> #include <vector> using namespace std; int main() { &n...
P1011
日期 题解:
iyishu
回复 0
|
赞 0
服了还考英语这题
P2020
字符串转化 题解:
故里526
回复 0
|
赞 1
#include<stdio.h> #include<string.h> int main(){ char a[100]; int i; int lenth; while(scanf("%s",a)!=EOF){ i...
P1551
判断二叉树是否对称 题解:
XCR553
回复 0
|
赞 3
//看了好几个都没有我的解法简单 #include <bits/stdc++.h> using namespace std; int main(){ string s; &nb...
P5104
约瑟夫问题的实现 题解:C语言实现
Assassin123
回复 0
|
赞 0
#include "stdio.h" #include "stdlib.h" int main() { int n, k; scanf("%d %d", &n, &k); int flag1 = 0;//用于数k int ...
P1035
简单背包问题 题解:
机试过过过·
回复 1
|
赞 4
#include<bits/stdc++.h> // 包含标准库,方便使用各种功能 using namespace std; int main(){ int s, n; // 定义变量s表示背包的容量,n表示物品的数量 while(cin >&...
P1125
求三角形的面积 题解:为啥过不去
李志豪
回复 1
|
赞 1
#include<stdio.h> #include<math.h> int main(){ float x1,y1,x2,y2,x3,y3; float s;  ...
P5238
AB博弈 题解:
知止而后动
回复 0
|
赞 1
这个问题类似于“拿石子游戏”,其中玩家每次可以拿1或2个石子,最后一个拿石子的人获胜。这种情况下,如果N是3的倍数,后手可以必胜;否则,先手可以必胜。
P5244
数组划分 题解:
fyy466
回复 0
|
赞 1
#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
#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
#include <stdio.h> int main() { int length = 0; int longest = 0; int position...
P1011
日期 题解:纯c
李志豪
回复 0
|
赞 6
#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
#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
暴力枚举 把一个变量从1开始递增,转化为二进制进行基数为-2的运算,所得结果与输入数比较。但是比较耗时。。。 #include<bits/stdc++.h> using namespace std; string judge(int n) { &nbs...
P1394
统计单词 题解:
山崎友希
回复 0
|
赞 6
#include<stdio.h> #include<string.h> #define MAXSIZE 100 int main(){ char string[MAXSIZE]; ...
P1580
一元三次方程求解 题解:
山崎友希
回复 0
|
赞 0
#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
#include<stdio.h> #include<string.h> #include<math.h> int main(){//那我问你,10的九次方是多少? //1000000000 确实 这就是10的9次方 //10000...
P2015
涂颜色 题解:
DASH106
回复 0
|
赞 2
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll string_mod(const string&s,ll mod){ ll res = ...
P1454
反序数 题解:
火火火。。。
回复 0
|
赞 3
#include<iostream> #include<stdio.h> using namespace std; int main() { for (int i = 1000; i <= 9999; i++) ...
P1454
反序数 题解:
火火火。。。
回复 0
|
赞 1
#include<iostream> #include<stdio.h> using namespace std; int main() { for (int i = 1000; i <= 9999; i++) ...
P1556
三元组 题解:
山崎友希
回复 0
|
赞 0
#include<stdio.h> int main(){ int N; scanf("%d",&N); int j=1; &nb...
P1095
Y/N 题解:
曦熙
回复 0
|
赞 2
#include<bits/stdc++.h> using namespace std; int main(){ int A,B,C,D; int M=0,j; cin>>A>&...
P1888
倒杨辉三角 题解:
20210512061
回复 0
|
赞 1
#include<stdio.h> #include<stdlib.h> int main(){ int a; while(scanf("%d",&a)!...
P1767
元素位置 题解:
山崎友希
回复 0
|
赞 0
#include<stdio.h> int main(){ int n; scanf("%d",&n); int a[n]; &n...
P1689
元素交换 题解:
山崎友希
回复 0
|
赞 0
#include<stdio.h> int main(){//给定一个长度为 [公式] 数组,将其中第偶数位置的元素与前一个元素交换。 int n; scanf("%d",&...
P1883
达到回文数 题解:
山崎友希
回复 0
|
赞 0
#include<stdio.h> #include<string.h> #include<math.h> int Reverse(int x){//Reverse函数实现把传进来的参数x翻转的效果! &nb...
P1411
二叉排序树2 题解:
诗岸梦行舟
回复 0
|
赞 1
#include<stdlib.h> #include<stdio.h> typedef struct node{ int data; struct node* lchild; struct node* rchild; }node; void...
P1208
2048的游戏 题解:优先队列so easy
西电机试专家
回复 0
|
赞 4
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin>>n;  ...
P5291
ASCII码排序 题解:神人题
西电机试专家
回复 0
|
赞 0
#include<bits/stdc++.h> using namespace std; bool cmp(char a,char b){ return a<b; } int main(){ &nbs...
P1888
倒杨辉三角 题解:long long long long
西电机试专家
回复 0
|
赞 0
#include<bits/stdc++.h> using namespace std; int main(){ int n; while(cin>>n) { &nbs...
1
2
我要提问
全站热榜
1
无法正确通过题目都是哪些原因造成的?
2
机试如何才能快速提高?
3
题目难点:数学公式不断化解
4
[置顶]计算机考研择校分析【25考研必读】
5
逻辑很简单,但是实现却要小心多多
6
A+B问题 题解:C
7
1017 幂次方 快速幂模板
8
广度优先搜索计算每个人移动到每个位置需要去掉障碍物的最少数目,最后求和的最小值
9
【25计算机考研】39所985院校录取分数线汇总
10
日期 题解: