2025/12/29 14:38:12
网站建设
项目流程
个人网站免费域名注册,大型网站建设的主要问题,微信上怎么做网站,大连零基础网站建设教学电话2025年重庆大学计算机考研复试机试真题
2025年重庆大学计算机考研复试上机真题
历年重庆大学计算机考研复试上机真题
历年重庆大学计算机考研复试机试真题
更多学校题目开源地址#xff1a;https://gitcode.com/verticallimit1/noobdream
N 诺 DreamJudge 题库#xff1…2025年重庆大学计算机考研复试机试真题2025年重庆大学计算机考研复试上机真题历年重庆大学计算机考研复试上机真题历年重庆大学计算机考研复试机试真题更多学校题目开源地址https://gitcode.com/verticallimit1/noobdreamN 诺 DreamJudge 题库输入 “学校名称” 即可筛选该校历年机试真题题目均在考纲范围内按难度自动排序。还可搭配《计算机考研机试攻略》刷题书中题目可通过题号直接在题库中查找。出现次数最多的数题目描述Time Limit: 1000 msMemory Limit: 256 mb给定n个正整数找出它们中出现次数最多的数。如果这样的数有多个请输出其中最小的一个。输入输出格式输入描述:输入的第一行只有一个正整数n(1 ≤ n ≤ 1000)表示数字的个数。 输入的第二行有n个整数s1, s2, …, sn (1 ≤ si ≤ 10000, 1 ≤ i ≤ n)。相邻的数用空格分隔。输出描述:输出这n个次数中出现次数最多的数。如果这样的数有多个输出其中最小的一个。输入输出样例输入样例#:6 10 1 10 20 30 20输出样例#:10代码一#include bits/stdc.husing namespace std;int main() {int n;cinn;vectorint v(n);mapint,int freq;for(int i0;in;i){cinv[i];freq[v[i]];}int result0;int max_count0;for(mapint,int::iterator itfreq.begin();it!freq.end();it){if(it-secondmax_count){resultit-first;max_countit-second;}else if(it-secondmax_countit-firstresult){resultit-first;}}coutresult;return 0;}代码二#include stdio.h#include string.h#include stdlib.h#include math.h#include time.hint main() {int n;scanf(%d,n);int a[1000];int hash[10001]{0};int max0;int i;for(i0;in;i){scanf(%d,a[i]);hash[a[i]];if(hash[a[i]]hash[max]||(hash[a[i]]hash[max]a[i]max)){maxa[i];}}printf(%d\n,max);return 0;}代码三#includebits/stdc.husing namespace std;int main(){int n;cinn;mapint,int m;while(n--){int temp;cintemp;if(m.find(temp) m.end()){m[temp] 1;}else{m[temp] m[temp] 1;}}int minn10000;int times 0;for(auto x : m){if(x.second times){times x.second;minn x.first;}else if(x.second times){minn min(minn,x.first);}else{}}coutminnendl;return 0;}