自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(109)
  • 收藏
  • 关注

原创 牛客网考研机试题集合:取中值

这里的合并两个数组,就是将数组2放在数组1的后面,然后去中间位置的数,不是排序后取中位数。#include<bits/stdc++.h>using namespace std;int main() { int n,m; while(cin>>n>>m) { vector<int> v1,v2,v3; int x; for...

2020-04-20 13:10:39 210

原创 牛客网考研机试题集合:围圈报数

考点:循环链表#include<bits/stdc++.h>using namespace std;const int MAXSIZE=1001;struct node { int e; node * next;};int main() { int m,n; cin>>m; while(m--) { cin>>n; node ...

2020-04-20 13:10:00 235

原创 牛客网考研机试题集合:Problem B

考点:矩阵注意:还有次对角线的和。。。#include<bits/stdc++.h>using namespace std;const int MAXSIZE=1001;int main() { int n; while(cin>>n) { int a[n][n]; for(int i=0; i<n; i++) { for(int ...

2020-04-20 13:09:36 220

原创 牛客网考研机试题集合:最长&最短文本

坑点:每行的字符串可能会有空格。。。方法:排序或者散列思想代码:散列思想#include<bits/stdc++.h>using namespace std;const int MAXSIZE=1001;int main() { string s; vector<string> v[MAXSIZE]; int ma=INT_MIN,mi=IN...

2020-04-20 13:09:20 170

原创 牛客网考研机试题集合:复数

注意:本题输出形式a+bi或则a-bi注意b>0,b=0,b<0,a==0的情况#include<bits/stdc++.h>using namespace std;const int MAXSIZE=1001;struct E { int x,y; E(int x,int y):x(x),y(y) { } E operator +(const E...

2020-04-20 13:08:55 131

原创 牛客网考研机试题集合:特殊乘法

简单题:先求各位数字的和,再相乘#include<bits/stdc++.h>using namespace std;int main(){ string s1,s2; while(cin>>s1>>s2){ int len1=s1.length(); int len2=s2.length(); ...

2020-04-20 13:08:05 121

原创 牛客网考研机试题集合:反序输出

字符串逆序方法一直接使用reverse(s.begin(),s.end())#include<bits/stdc++.h>using namespace std;int main(){ string s; while(cin>>s){ reverse(s.begin(),s.end()); cout<&lt...

2020-04-20 13:07:31 148

原创 牛客网考研机试题集合:任务调度

考点:拓扑排序注意:字符串的编号如何确定?每个字符串后面的数字表示编号吗?一定是Task?#include<bits/stdc++.h>using namespace std;const int MAXSIZE=1001;struct node { string name; vector<string> sons; int in;};map&lt...

2020-04-20 13:02:58 370

原创 牛客网考研机试题集合:Flipping Pancake

考点:排序通过翻转操作对1~N进行排序思路:见题目备注#include<bits/stdc++.h>using namespace std;const int MAXSIZE=1001;int main() { int n; while(cin>>n) { if(n==0) { break; } int a[n+1]; fo...

2020-04-20 11:31:31 103

原创 牛客网考研机试题集合:完数 3

超时代码:时间复杂度O(n^2)#include<bits/stdc++.h>using namespace std;const int MAXSIZE=1001;int main() { int a,b; while(cin>>a>>b) { for(int i=a; i<=b; i++) { int sum=0; f...

2020-04-19 11:23:23 132

原创 牛客网考研机试题集合:分组统计

考点:map容器,set容器使用set<int> 记录元素vector<int>v[n] v[i]存储i组中的元素map<int,int> 记录元素的个数#include<bits/stdc++.h>using namespace std;const int MAXSIZE=1001;int main() { int ...

2020-04-19 10:26:04 295

原创 牛客网考研机试题集合:编排字符串

考点:栈#include<bits/stdc++.h>using namespace std;const int MAXSIZE=1001;int main() { int n; while(cin>>n) { stack<string> st,st2; string s; for(int i=0; i<n; i++) {...

2020-04-19 10:06:34 116

原创 牛客网考研机试题集合:日期累加

考点:日期处理注意:天数增加的过程中,月份,年份都会发生变化。#include<bits/stdc++.h>using namespace std;const int MAXSIZE=1001;#define ISYEAP(x) x%4==0&&x%100!=0||x%400==0?1:0int a[13][2]= {0,0, ...

2020-04-19 10:05:34 131

原创 牛客网考研机试题集合:打印日期

考点:日期计算#include<bits/stdc++.h>using namespace std;const int MAXSIZE=1001;int day1[13]= {0,31,59,90,120,151,181,212,243,273,304,334,365};int day2[13]= {0,31,60,91,121,152,182,213,244,274,3...

2020-04-19 09:57:34 142

原创 牛客网考研机试题集合:查找 2

考点:字符串操作#include<bits/stdc++.h>using namespace std;const int MAXSIZE=1001;int main() { string str; while(cin>>str) { int n; cin>>n; string cmd; for(int i=0; i<n; ...

2020-04-18 12:45:53 164

原创 牛客网考研机试题集合:复数集合

考点:模拟,数据结构使用优先队列模拟大顶堆或者普通容器存储后再排序。代码一:#include<bits/stdc++.h>using namespace std;const int MAXSIZE=1001;struct E { int x,y; int l; E(int x,int y,int l):x(x),y(y),l(l) { } bool o...

2020-04-18 12:45:43 138

原创 牛客网考研机试题集合:查找

考点:查找利用map或者set,加快查找#include<bits/stdc++.h>using namespace std;const int MAXSIZE=1001;int main() { int n; while(cin>>n) { map<int,int>m; int x,N; for(int i=0; i&lt...

2020-04-18 12:45:31 341

原创 牛客网考研机试题集合:调整方阵

考点:矩阵的操作注意:一列中最大数有多个,选取行数较小的#include<bits/stdc++.h>using namespace std;const int MAXSIZE=1001;int main() { int n; while(cin>>n) { int a[n][n]; for(int i=0; i<n; i++) {...

2020-04-18 12:45:09 154

原创 牛客网考研机试题集合:合并符串

考点:字符串#include<bits/stdc++.h>using namespace std;const int MAXSIZE=1001;int main() { string a,b; while(cin>>a>>b) { int l=a.length(); for(int i=0; i<l; i++) { co...

2020-04-18 12:44:54 121

原创 牛客网考研机试题集合:求两个多项式的和

考点:数学问题利用map容器#include<bits/stdc++.h>using namespace std;const int MAXSIZE=1001;int main() { int n,m; while(cin>>n) { map<int,int> ma; int a,b; for(int i=0; i<n...

2020-04-18 12:44:43 252 1

原创 牛客网考研机试题集合:杨辉三角形

考点:组合数=+ 即fun(n,m)#include<bits/stdc++.h>using namespace std;const int MAXSIZE=1001;int fun(int n,int m);int main() { int n; while(cin>>n) { int i,j; for(i=1; i<n; ...

2020-04-18 12:44:33 246

原创 牛客网考研机试题集合:矩阵转置

考点:矩阵使用swap(),交换对角线的元素#include<bits/stdc++.h>using namespace std;const int MAXSIZE=1001;int main() { int n; while(cin>>n) { int a[n][n]; for(int i=0; i<n; i++) { for...

2020-04-18 12:44:18 173

原创 牛客网考研机试题集合:统计单词

考点:字符串#include<bits/stdc++.h>using namespace std;const int MAXSIZE=1001;int main() { string s; while(getline(cin,s)) { int l=s.length()-1; vector<int> v; for(int i=0; i&lt...

2020-04-18 12:44:00 95

原创 牛客网考研机试题集合:矩阵幂

考点:矩阵乘法,快速矩阵幂本题:不使用快速幂运算也不会超时方法一:快速幂方法二:将二维数组转换为一维数组

2020-04-18 12:42:58 155

原创 牛客网考研机试题集合:查找第K小数

考点:排序,查找#include<bits/stdc++.h>using namespace std;const int MAXSIZE=1001;int main() { int n; while(cin>>n) { set<int> s; int x; for(int i=0; i<n; i++) { cin&gt...

2020-04-17 10:54:52 110

原创 牛客网考研机试题集合:哈弗曼树

考点:哈弗曼树#include<bits/stdc++.h>using namespace std;const int MAXSIZE=1001;int main() { int n; while(cin>>n) { priority_queue<int,vector<int>,greater<int> > q;...

2020-04-17 10:45:21 130

原创 牛客网考研机试题集合:二进制数

考点:进制转换#include<bits/stdc++.h>using namespace std;const int MAXSIZE=1001;int main() { int n; while(cin>>n) { string s=""; do { s=char(n%2+'0')+s; n/=2; } while(n); ...

2020-04-17 10:39:52 216 1

原创 牛客网考研机试题集合:旋转矩阵

考点:基础对比:C翻转默认:顺时针旋转90度:上下行翻转,再沿副对角线交换180:上下行翻转,再左右行翻转270:左右行翻转,再沿副对角线交换#include<bits/stdc++.h>using namespace std;const int MAXSIZE=1001;void r90(int a[9][9],int n);void r180(in...

2020-04-17 08:01:09 318

原创 牛客网考研机试题集合:C翻转

考点:基础旋转可通过交换来实现。顺时针:上下翻转,再沿副对角线交换顺时针:左右翻转,再沿副对角线交换#include<bits/stdc++.h>using namespace std;const int MAXSIZE=1001;int main() { int b,c,x,y,a[5][5]; while(cin>>a[0][0]) {...

2020-04-17 08:00:45 115

原创 牛客网考研机试题集合:素数

考点:素数#include<bits/stdc++.h>using namespace std;const int MAXSIZE=1001;vector<int> prime;int mark[10001];void init();int main() { int n; init(); while(cin>>n) { int i=...

2020-04-17 07:07:53 106

原创 牛客网考研机试题集合:比较奇偶数个数

考点:查找#include<bits/stdc++.h>using namespace std;const int MAXSIZE=1001;int main() { int n; while(cin>>n) { int x,cnt=0; for(int i=0; i<n; i++) { cin>>x; if(x&...

2020-04-17 00:42:34 123

原创 牛客网考研机试题集合:找最小数

考点:查找#include<bits/stdc++.h>using namespace std;const int MAXSIZE=1001;int main() { int n; while(cin>>n) { int minX=INT_MAX,minY=INT_MAX; int x,y; for(int i=0; i<n; i++...

2020-04-17 00:42:15 166

原创 牛客网考研机试题集合:堆栈的使用

考点:栈#include<bits/stdc++.h>using namespace std;const int MAXSIZE=1001;int main() { int n; while(cin>>n) { stack<int> s; char c; int x; if(n==0) { break; } f...

2020-04-17 00:21:42 817

原创 牛客网考研机试题集合:搬水果

考点:哈夫曼树#include<bits/stdc++.h>using namespace std;const int MAXSIZE=1001;int main() { int n; while(cin>>n) { if(n==0) { break; } priority_queue<int,vector<int>,...

2020-04-17 00:09:42 424

原创 牛客网考研机试题集合:最大公约数

考点:数学问题#include<bits/stdc++.h>using namespace std;const int MAXSIZE=101;int gcd(int a,int b);int main() { int a,b; while(cin>>a>>b) { cout<<gcd(a,b)<<endl; ...

2020-04-16 16:15:01 202

原创 牛客网考研机试题集合:众数

考点:散列思想#include<bits/stdc++.h>using namespace std;const int MAXSIZE=101;int main() { int x; while(cin>>x) { int m[11]; fill(m,m+11,0); m[x]++; for(int i=1; i<20; i++)...

2020-04-16 16:10:34 158

原创 牛客网考研机试题集合:判断三角形类型

考点:数学问题,勾股定理#include<bits/stdc++.h>using namespace std;const int MAXSIZE=101;int main() { int a[3]; while(cin>>a[0]) { cin>>a[1]>>a[2]; sort(a,a+3); if(a[0]*a[0...

2020-04-16 16:10:00 137

原创 牛客网考研机试题集合:互换最大值最小值

考点:元素交换,查找最值#include<bits/stdc++.h>using namespace std;const int MAXSIZE=101;int main() { int n; while(cin>>n) { int a[n]; int minX=INT_MAX,maxX=INT_MIN; int p1,p2; for(i...

2020-04-16 15:54:54 151

原创 牛客网考研机试题集合:找x

考点:查找#include<bits/stdc++.h>using namespace std;const int MAXSIZE=101;int main() { int n; while(cin>>n) { map<int,int> m; int x; for(int i=0; i<n; i++) { cin&gt...

2020-04-16 15:52:44 131

原创 牛客网考研机试题集合:百鸡问题

考点:搜索这里出现了1/3,为了数据处理,全部扩大3倍,而不是使用double型#include<bits/stdc++.h>using namespace std;const int MAXSIZE=101;int main() { int n; while(cin>>n) { for(int x=0; x<=100; x++) { ...

2020-04-16 15:39:58 105

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除