首页
DreamJudge
院校信息
考研初试
机试真题
讨论区
兑换中心
登录
注册
上岸
搜索
推 荐
择校分析
笔经面经
学习交流
我要提问
站内公告
调剂专题
精彩爆料
解题报告
P1347
To Fill or Not to Fi 题解(贪心):
cczz
回复 0
|
赞 0
贪心策略: 在当前加油站,寻找在最大行驶距离(即满油箱所能行驶的距离)内价格最低的加油站作为下一个目的地。 距离从近到远找,如果找到了加油站价格比当前加油站更低,无需判断后续加油站,只加足够到达该加油站的油;否则加满油。 ...
P1307
组队刷题 题解:
cczz
回复 0
|
赞 0
#include<bits/stdc++.h> using namespace std; struct Node { int cnt; int cost; } node[1005]; int main() { int m, n; ...
P1024
二元组整数 题解:回溯模板题(类似于求排列数),可以用set判断是否重复,这里因
2072166673
回复 0
|
赞 0
#include<bits/stdc++.h> using namespace std; vector<int> path; vector<vector<int> > result; void backtracking(vector<...
P1383
查找第K小数 题解(排序去重):
cczz
回复 0
|
赞 0
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { int n; while (cin ...
P1388
查找1 题解:
cczz
回复 0
|
赞 0
#include<bits/stdc++.h> using namespace std; int main(){ int n, m; map<int, int> mp; cin >> n; int t; for(i...
P1177
查找学生信息 题解:
cczz
回复 0
|
赞 0
#include<bits/stdc++.h> using namespace std; int main(){ int n, m; while(cin >> n >> m){ int a[205]; int bookC...
P1404
成绩排序 - 华科 题解(构造比较函数,轻松解决):
cczz
回复 0
|
赞 1
#include<bits/stdc++.h> using namespace std; struct Student{ string name; int age; int grade; }; int main(){ int n; wh...
P1399
排序 - 华科 题解(sort快速解决):
cczz
回复 0
|
赞 0
#include<bits/stdc++.h> using namespace std; int main(){ int n; while(cin >> n){ int a[105]; for(int i = 0; i < n...
P1261
字符串排序3 题解:
cczz
回复 0
|
赞 0
#include<bits/stdc++.h> using namespace std; int main(){ int n; while(cin >> n){ getchar(); // 消除回车影响 vector<strin...
P1255
字符串排序2 题解:
cczz
回复 0
|
赞 0
#include<bits/stdc++.h> using namespace std; int main(){ string line; while(getline(cin, line)){ vector<char> letters; ...
P1254
字符串排序 题解:
cczz
回复 0
|
赞 0
#include<bits/stdc++.h> using namespace std; int main(){ char a[25]; cin >> a; sort(a, a+strlen(a)); for(int i = 0; i < ...
P1217
国名排序 题解:
cczz
回复 0
|
赞 0
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; vector<string> countries(n); for(int ...
P1159
成绩排序2.0 题解:
cczz
回复 0
|
赞 0
#include<bits/stdc++.h> using namespace std; struct Student{ int id; int grade; }stu[105]; bool cmp(Student a, Student b){ if...
P1027
删除字符串(正则表达式解法,两行核心代码):
cczz
回复 0
|
赞 0
1.正则表达式解法 #include <bits/stdc++.h> using namespace std; int main() { string s; getline(cin, s); // 使用 icase 标...
P1394
统计单词 题解:
cczz
回复 0
|
赞 0
#include<bits/stdc++.h> using namespace std; int main(){ string s; while(getline(cin, s)){ int cnt = 0; char before = '...
P1240
首字母大写 题解(采用stl轻松解决):
cczz
回复 0
|
赞 0
#include<bits/stdc++.h> using namespace std; int main(){ char s[105]; gets(s); char before = ' '; for(int i = 0; i < s...
P1292
字母统计 题解:
cczz
回复 0
|
赞 0
#include<bits/stdc++.h> using namespace std; int main(){ string s; getline(cin, s); int cnt[50] = {0}; for(int i = 0; i &...
P1012
字符移动 题解:
cczz
回复 0
|
赞 0
#include<bits/stdc++.h> using namespace std; int main(){ char s[105]; char out[105]; gets(s); int idx = 0; int len = st...
P1053
偷菜时间表 题解:
cczz
回复 0
|
赞 0
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; while(n -- > 0){ int minu = (13*60 + 15); ...
P1446
日期累加 题解(条理清晰,计算总天数):
cczz
回复 0
|
赞 0
#include<bits/stdc++.h> using namespace std; int month[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31}; bool isLeapYear(int y){ retu...
P1437
日期类 题解:
cczz
回复 0
|
赞 0
#include<bits/stdc++.h> using namespace std; int month[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31}; bool isLeapYear(int y){ retu...
P1410
打印日期 题解:
cczz
回复 0
|
赞 0
#include<bits/stdc++.h> using namespace std; int month[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31}; bool isLeapYear(int y){ retu...
P1290
日期差值 题解:
cczz
回复 0
|
赞 1
#include<bits/stdc++.h> using namespace std; int month[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31}; bool isLeapYear(int y){ retu...
P1011
日期 题解:
cczz
回复 0
|
赞 2
#include<bits/stdc++.h> using namespace std; int main(){ int m,d; cin >> m >> d; int a[13] = {0, 31, 28, 31, 30, ...
P1897
IP地址方案数 题解:
Sunny~
回复 0
|
赞 0
dfs,u控制每次枚举的是A、B、C还是D,对于每个枚举的结果check函数去检查是否符合题意 #include<bits/stdc++.h> using namespace std; int n,cnt; string s; vector<int> ...
P1472
2048游戏 题解:
cczz
回复 0
|
赞 1
#include<bits/stdc++.h> using namespace std; void merge(int *b){ int front = b[0]; int flag = 0; // front是否为合并后的结果 for(int i = 1;...
P1221
旋转矩阵 题解:
cczz
回复 0
|
赞 0
矩阵旋转题目,把握好顺时针旋转90度的逻辑、和纵向对折交换即可 tip:建议采用vector容器,便于数组处理 #include<bits/stdc++.h> using namespace std; // 矩阵顺时针旋转90度 vector<vec...
P1679
最短距离 题解:纯数学问题。写出关于时间t的函数,然后在t>=0时候求最小值就行
2072166673
回复 0
|
赞 0
#include<bits/stdc++.h> using namespace std; int main() { int m; cin>>m; &...
P1216
旋转方阵 题解:
cczz
回复 0
|
赞 0
关键: 1.根据题目要求进行模拟,d用于控制填充方向 2.注意输出格式 #include<bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; ...
P1377
旋转矩阵 - 北航 题解:
cczz
回复 0
|
赞 1
关键点: 1.找到旋转90度的规律 2.如何比较数组相等 tip:采用vector容器代替数组 #include<bits/stdc++.h> using namespace std; // 顺时针旋转90度 vector<v...
P1377
旋转矩阵 - 北航 题解(找规律暴力求解):
cczz
回复 0
|
赞 0
#include<bits/stdc++.h> using namespace std; int main(){ int n; while(cin >> n){ int a[10][10]; int b[10][10]; ...
P1392
杨辉三角形(不输出第一行) - 西北工业大学 题解:
cczz
回复 0
|
赞 0
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; int a[105][105] = {0}; a[1][1] = 1; a[2][1] ...
P1662
最少钱币数 题解:贪心c++
2072166673
回复 0
|
赞 0
#include<bits/stdc++.h> using namespace std; int main() { int coins[6]={100,50,10,5,2,1};//记录钱币面额 &nbs...
P1872
二进制数!!!!!! 题解:
18919717626
回复 0
|
赞 0
注意开long long,其实就是统计二进制中0的个数,如果输入为0高位不补1,否则高位补1 #include <iostream> #include <vector> using namespace std; typedef long long L...
P1417
八进制 题解:
cczz
回复 0
|
赞 0
#include<bits/stdc++.h> using namespace std; int main(){ int num; while(scanf("%d", &num) != EOF){ char out[105]; int ...
P1715
十进制转二进制 题解:
cczz
回复 0
|
赞 0
#include<bits/stdc++.h> using namespace std; int main(){ int num; while(scanf("%d", &num) != EOF){ char out[105]; int ...
P1259
进制转换2 题解:
cczz
回复 0
|
赞 0
#include<bits/stdc++.h> using namespace std; int main(){ char s[105]; while(scanf("%s",s) != EOF){ int res = 0; int len = ...
P1454
反序数 题解:
cczz
回复 0
|
赞 0
#include<bits/stdc++.h> using namespace std; int main(){ for(int i = 1000; i <= (9999/9); i++) { int res = i*9; ...
P1722
身份证校验 题解:
cczz
回复 0
|
赞 0
#include<bits/stdc++.h> using namespace std; int w[] = {7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2}; int trans[] = {1,0,'X'-'0',9,8,7,6,5,4,3...
P5252
考试招生 题解:
XCR553
回复 0
|
赞 0
//特判错误数据 #include<string.h> #include<iostream> #include<algorithm> #include<vector> using namespace std; struct S...
P1176
十进制和二进制 题解:
18919717626
回复 0
|
赞 0
#include <iostream> #include <algorithm> #include <vector> using namespace std; int r; string a, b; vector<int&g...
P1102
素数判定 题解:
XCR553
回复 0
|
赞 0
//欧拉筛+前缀和,O(n)的复杂度 #include<iostream> using namespace std; const int N = 1000; int prime[N+5]; bool notPrime[N+5]; int pre[N+5]; int...
P1043
计算Sn 题解:
波耶菠萝蜜
回复 0
|
赞 0
核心在于移位, // 输出样例#: // 24690 #include <stdio.h> #include <math.h> int main(){ int a,n...
P1022
删除最大最小数 题解:简单模拟,就是题目说明不清,不知道全是相同数的输出这个数本
2072166673
回复 0
|
赞 1
#include<bits/stdc++.h> using namespace std; int main() { int n; while(cin>>n) &nbs...
P1053
偷菜时间表 题解:
波耶菠萝蜜
回复 0
|
赞 0
重点在于变换 用/%其实是最快的,想试试函数调用hhhh #include<stdio.h> int change(int mintue); int remians(int mintue); int main(){ &...
P1135
矩阵求和 题解:
波耶菠萝蜜
回复 0
|
赞 0
也是非常类似矩阵翻转 #include <stdio.h> int main(){ int n=0;//表示矩阵大小; scanf("%d",&n); ...
P1134
矩阵翻转 题解:
波耶菠萝蜜
回复 0
|
赞 0
两段while for 是对称的,改一下scanf就行了 #include <stdio.h> int main(){ int n=0;//表示矩阵大小; scanf("%d",&n); int a[n]...
P1128
疯狂的小面包 题解:
波耶菠萝蜜
回复 0
|
赞 0
非常简单的if——else,注意一下用double就行 #include <stdio.h> int main(){ double dist,v,w,t;//新老区距离  ...
P1125
求三角形的面积 题解:
波耶菠萝蜜
回复 0
|
赞 0
用的是海伦公式 #include <stdio.h> #include <math.h> int main() { int a1,a2,b1,b2,c1,c2;  ...
P1040
利润提成 题解:
wjh925
回复 0
|
赞 0
#include<stdio.h> int main() { long int i; int p = (1000000-600000)*0.015; int ...
1
2
我要提问
全站热榜
1
无法正确通过题目都是哪些原因造成的?
2
[置顶]计算机考研择校分析【25考研必读】
3
机试如何才能快速提高?
4
题目难点:数学公式不断化解
5
逻辑很简单,但是实现却要小心多多
6
A+B问题 题解:C
7
1017 幂次方 快速幂模板
8
【25计算机考研】39所985院校录取分数线汇总
9
广度优先搜索计算每个人移动到每个位置需要去掉障碍物的最少数目,最后求和的最小值
10
【23计算机考研】39所985院校录取分数线汇总