主站
DreamJudge
院校信息
专业题库
模拟考试
机试真题
专业课程
讨论区
兑换中心
登录
注册
上岸
搜索
推 荐
择校分析
笔经面经
学习交流
我要提问
站内公告
调剂专题
精彩爆料
解题报告
P1012
字符移动 题解:
活着的传奇
回复 0
|
赞 0
|
浏览 674
做麻烦了。先把数字存进一个b数组,然后把再把非数字的存入另外一个c数组,然后输出即可。 #include<bits/stdc++.h> using namespace std; bool shuzi(char c){ if(c>='0'&...
P1248
整数奇偶排序 题解:
Syou
回复 0
|
赞 0
|
浏览 491
C++ 清空vector使用clear() #include <iostream> #include <vector> #include <algorithm> using namespace std; int main(){ v...
P1159
成绩排序2.0 题解:
Syou
回复 0
|
赞 0
|
浏览 710
C++ cmp函数保证先比较分数score,分数相同比较学号id #include <iostream> #include <string> #include <algorithm> #include <vector> u...
P1151
成绩排序 题解:
Syou
回复 0
|
赞 0
|
浏览 821
C++ stable_sort() while(cin>>xxx) #include <iostream> #include <string> #include <vector> #include <algori...
P1240
首字母大写 题解:
Syou
回复 2
|
赞 0
|
浏览 804
C++ 求帮助!通过率只有80% 实在想不到有什么问题了,在本地试了很多测试用例 #include <iostream> #include <string> using namespace std; int main(){ string ...
P1027
删除字符串2 题解:
Syou
回复 0
|
赞 0
|
浏览 874
C++ 一开始写的代码 #include <iostream> #include <string> using namespace std; int main() { string s; getline(cin, s); ...
P1446
日期累加 题解:
Syou
回复 0
|
赞 2
|
浏览 750
C++ 果然是同一所大学的题,和1437差不多。不过就是加1天改为了加past天 原题:1437 - 日期类 _N诺计算机考研 (noobdream.com) 我的1437做法:日期类 题解:_P1437_N诺计算机考研 (noobdream.com) ...
P1437
日期类 题解:
Syou
回复 0
|
赞 1
|
浏览 661
C++ 逐个单独处理年末和月末的情况 #include <iostream> #include <iomanip> using namespace std; bool isLeapYear(int year){ return (ye...
P1722
身份证校验 题解:
xuan_yu
回复 0
|
赞 2
|
浏览 599
C++ 基于map,纯粹是想用时键值对(实际上直接数组映射就行) 别的没啥,注意两个bug就行 #include<bits/stdc++.h> using namespace std; int main() { map&...
P1392
杨辉三角形 - 西北工业大学 题解:
Syou
回复 3
|
赞 1
|
浏览 1.0k
#include <iostream> using namespace std; int binomialCoefficient(int n, int k){ if(k == 0 || k == n){ return 1; } return binomia...
P897
使用哈希表即可,严格意义上也不算dp算法
928上岸梦校!
回复 0
|
赞 2
|
浏览 617
使用一张哈希表unordered_map存储下标为i的元素是连续递增子序列中的第几个元素,即当前子序列的长度。 需要使用到动态规划的经典例题是最长递增子序列,由于在此题中加入了连续的要求,因此不需要回溯,将数组中的每个元素都当作连续递增序列的开始元素即可,同时继承上一个元素的长度再加一更...
P1012
字符串加法
928上岸梦校!
回复 0
|
赞 1
|
浏览 495
#include <bits/stdc++.h> using namespace std; int main() { string s; string digits; string nd; cin >> s; for (auto i...
P1014
求余
928上岸梦校!
回复 0
|
赞 1
|
浏览 499
借鉴循环队列的思想,使用求余操作实现将字母转换为后三个 #include <bits/stdc++.h> using namespace std; int main() { string s; getline(cin, s); for (auto...
P1176
十进制和二进制 题解:
fxl
回复 0
|
赞 0
|
浏览 987
while True: try: a = eval(input()) b = list() while a>0: b.append(a%2) a=a//2 ...
P1885
正整数分解质因数 题解:
hdhduxhd
回复 0
|
赞 1
|
浏览 381
#include<bits/stdc++.h> using namespace std; int main(){ int n; while(cin>>n){ &...
P1382
哈夫曼树 题解:优先队列
dongqing
回复 0
|
赞 0
|
浏览 448
合并果子同个思路 #include<bits/stdc++.h> using namespace std; int main() { int n; while(cin>>n) { int x...
P1216
题目提示
dsfj
回复 2
|
赞 0
|
浏览 11.9k
这里不好发图,我就用文字描述 可将结果分为几圈。例如:5可以分成3圈(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16)(17 18 19 20 21 22 23 24)(25) 每一圈执行的操作是:下->右->上->左 ...
P1216
螺旋打印,每个方向打印完之后重新调整阈值以适应下一次打印
928上岸梦校!
回复 0
|
赞 1
|
浏览 623
#include <bits/stdc++.h> using namespace std; void generateSpiralMatrix(int n) { vector<vector<int>> matrix(n, vect...
P1377
找出顺时针90度的索引变化规律就可以知道全部规律
928上岸梦校!
回复 0
|
赞 2
|
浏览 808
90度的规律:tempMatrix[j][n - i - 1] = matrix1[i][j] 其余角度的可以看成多次90度旋转 时间复杂度为O(n^2) #include <bits/stdc++.h> using namespace std; ...
P4922
数组方法
928上岸梦校!
回复 0
|
赞 1
|
浏览 366
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<vector<int>> vec...
P1392
1_非递归(c、c++递归会了再回来)
lesen_98
回复 2
|
赞 1
|
浏览 8.8k
#include<bits/stdc++.h> using namespace std; int a[21][21]; int main(){ int n; while(scanf("%d",&n) != EOF){ for(int i...
P3684
求n个数两两之间的LCM
928上岸梦校!
回复 0
|
赞 2
|
浏览 526
利用最小公倍数和最大公约数之间的关系。 我们可以利用如下的性质来计算 n 个数的最小公倍数: LCM(a, b, c) = LCM(LCM(a, b), c) 也就是说,n 个数的最小公倍数等于先计算前两个数的最小公倍数,然后再将得到的最小公倍数与下一个数计算最小公倍数,依次...
P1259
简简单单秦九韶算法
考小研
SVIP
回复 0
|
赞 1
|
浏览 533
#include<iostream> using namespace std; int main() { string num16; while (cin >> num16) { unsigned long long sum = 0; for...
P1426
最大公约数1 题解:递归+O(1)空间复杂度
考小研
SVIP
回复 0
|
赞 0
|
浏览 418
#include<stdio.h> unsigned gcd(unsigned a, unsigned b){ //默认a>b if(b == 0) return a; else return gcd(b, a%b); } int main(){ i...
P1567
dp数组O(n)终极优化版+vector动态更新路径(内存254kb,运行时间4
考小研
SVIP
回复 0
|
赞 0
|
浏览 500
#include<iostream> #include<vector> using namespace std; int main() { int M, N; while (cin >> M >> N) { int dp[...
P1567
Buyer 题解:dp数组空间优化,大部分数据都是对的,求各位大佬帮忙找找茬
考小研
SVIP
回复 8
|
赞 0
|
浏览 697
#include<iostream> #include<cstring> using namespace std; int main() { //dp表示背包数组,w是物品的钱数数组,v是物品受欢迎程度数组 //M是可支配钱数,N是物品数,c是保存物品...
P1259
2
xuyuli
回复 2
|
赞 3
|
浏览 13.2k
#include<bits/stdc++.h> using namespace std; int main(){ char a[105]; while(cin>>a){ &...
P1008
C++常规解法
928上岸梦校!
回复 0
|
赞 2
|
浏览 500
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int count1 = 0; while (n != 0) { if (...
P1133
等差数列数学方法,常数时间复杂度
928上岸梦校!
回复 0
|
赞 1
|
浏览 547
C++参考代码如下: #include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; cout << (1 + n) * n / 2;...
P1086
采药 题解:只需要O(n)的dp数组,0-1背包问题套路
考小研
SVIP
回复 0
|
赞 1
|
浏览 418
#include<iostream> #include<cstring> using namespace std; int main(){ int dp[1001], w, v, T, M; cin >> T >> M; m...
1
...
54
55
56
57
58
...
126
我要提问
近期热门
1
N诺成就值出炉,帮你一眼识别大神
2
机试如何才能快速提高?
3
[置顶]计算机考研择校分析【25考研必读】
4
广度优先搜索计算每个人移动到每个位置需要去掉障碍物的最少数目,最后求和的最小值
5
1377旋转矩阵
6
ip地址(C)
7
简单易懂
8
C++递归解法,有注释
9
1017 幂次方 快速幂模板
10
计算机考研复试笔记——操作系统篇