编写题解 2973: 出现次数超过一半的数 摘要:解题思路:先计数排序 再判断注意事项:参考代码:#include<bits/stdc++.h>using namespace std;typedef long long ll;const int N=…… 题解列表 2024年07月22日 0 点赞 0 评论 532 浏览 评分:9.9
题解 2973: 出现次数超过一半的数 摘要:解题思路:注意事项:参考代码:#include <bits/stdc++.h>using namespace std;int n,tong[1003];int main(){ cin>>n; for(…… 题解列表 2024年07月16日 0 点赞 0 评论 460 浏览 评分:0.0
2973: 出现次数超过一半的数 解题思路:注意事项:参考代码:#includeusingnamespacestd;typedeflonglongll;constllN=1e5;inttong[N];intmain(){intn;cin>>n;for(inti=1;i<=n;i++){inta;cin>>a;tong[a+50]++; 题解列表 2024年07月15日 0 点赞 0 评论 440 浏览 评分:9.9
~~【Java】版本~~ 摘要:解题思路:注意事项:参考代码:import java.util.*; public class Main { public static void main(String[] args…… 题解列表 2024年02月21日 0 点赞 0 评论 519 浏览 评分:0.0
2973: 出现次数超过一半的数 摘要:解题思路:注意事项:参考代码:#include <bits/stdc++.h>using namespace std;int tong[1005];int main(){ int n; c…… 题解列表 2023年10月21日 0 点赞 0 评论 617 浏览 评分:0.0
c语言代码解决问题 摘要:解题思路:注意事项:参考代码:#include<stdio.h>int main(){ int n, i, j,a[1000],sum=1,max_sum=1,max_num; scanf…… 题解列表 2023年06月11日 0 点赞 0 评论 486 浏览 评分:0.0
出现次数超过一半的数 可AC 摘要:解题思路:注意事项:参考代码:#include<stdio.h>#include<malloc.h>#include<stdlib.h>int main(){ int n,flag=0,a[100]=…… 题解列表 2023年03月14日 0 点赞 0 评论 524 浏览 评分:0.0
2973: 出现次数超过一半的数 ```cpp//这道题我是用桶的思想去做的//有一点需要注意,是n的范围,从-50开始,但数组的下标是不会有负数的所以加上50即可#includeusingnamespacestd;inta[1001],b[2000],n,f;intmain(){cin>>n;for(inti=1;i>a[i];b[ 题解列表 2023年03月11日 0 点赞 0 评论 582 浏览 评分:9.9
2973: 出现次数超过一半的数 ```cpp#include#includeusingnamespacestd;intmain(){inta[1001],b[1001],n;memset(b,0,sizeof(b));cin>>n;for(inti=0;i>a[i];a[i]+=50;++b[a[i]];}for(inti=0;in 题解列表 2023年02月17日 0 点赞 0 评论 496 浏览 评分:9.9
出现次数超过一半的数(C语言版) 摘要:解题思路:这里要一个存储个数的数组b,然后把各个数的个数放到b中。注意事项:注意这里加减50的原因是,数组的下标没有负数,其他的就没啥了。参考代码:#include<stdio.h>int main(…… 题解列表 2023年01月30日 0 点赞 0 评论 693 浏览 评分:9.9