当前位置:网站首页>Match 56 de la semaine d'acwing [terminé]
Match 56 de la semaine d'acwing [terminé]
2022-06-23 07:48:00 【Une petite chanson.】
https://www.acwing.com/activity/content/competition/problem_list/1939/
Table des matières
4482. Groupe

#include<bits/stdc++.h>
using namespace std;
const int N=1e4+10;
int n,a[N],ans;
map<int,int>mp;
int main(void)
{
cin>>n;
for(int i=0;i<n;i++) cin>>a[i],mp[a[i]]++,ans=max(ans,mp[a[i]]);
cout<<ans;
return 0;
}
#include<bits/stdc++.h>
using namespace std;
const int N=1e4+10;
int n,a[N];
int main(void)
{
cin>>n;
for(int i=0;i<n;i++) cin>>a[i];
vector< map<int,int> >ve;
for(int i=0;i<n;i++)
{
if(ve.size()==0)
{
map<int,int>mp; mp[a[i]]++;
ve.push_back(mp);
}else
{
bool flag=1;
for(int j=0;j<ve.size();j++)
{
auto temp=ve[j];
if(temp.count(a[i])==0)
{
temp[a[i]]++;
ve[j]=temp;
flag=0;
break;
}
}
if(flag)
{
map<int,int>mp; mp[a[i]]++;
ve.push_back(mp);
}
}
}
cout<<ve.size()<<endl;
return 0;
}
4483. Champ de bataille

#include<bits/stdc++.h>
using namespace std;
const int N=1e6+10;
int n,k,a[N],st[N];
priority_queue<int,vector<int>,greater<int>>q;
int main(void)
{
cin>>n>>k;
for(int i=1;i<=n;i++) scanf("%d",&a[i]),st[a[i]]++;
int ans=0;
for(int i=1;i<=1e6;i++) if(st[i]) q.push(i);
while(q.size()>=2)
{
auto s1=q.top(); q.pop();
auto s2=q.top(); q.pop();
if(abs(s1-s2)<=k)
{
st[s1]--;
if(st[s1]) q.push(s1);
q.push(s2);
}else q.push(s2);
}
for(int i=1;i<=1e6;i++) if(st[i]) ans+=st[i];
cout<<ans;
return 0;
}
4484. Décimales finies【Penser】

qEffacerb^k
#include<bits/stdc++.h>
using namespace std;
typedef long long int LL;
LL gcd(LL a,LL b)
{
return b?gcd(b,a%b):a;
}
int main(void)
{
int t; scanf("%d",&t);
while(t--)
{
LL p,q,b; scanf("%lld%lld%lld",&p,&q,&b);
LL d=gcd(p,q);
q/=d;
while(q>1)
{
d=gcd(q,b);
if(d==1) break;
while(q%d==0) q/=d;
}
if(q==1) puts("YES");
else puts("NO");
}
return 0;
}
边栏推荐
- 跳跃表原理
- How to quickly and gracefully download large files from Google cloud disk (II)
- Unity picture loading and saving
- [Planet selection] how to efficiently build fine-grained two-way links between roam and thebrain?
- Console Application
- [markdown] markdown tutorial summary
- MIT CMS.300 Session 12 – IDENTITY CONSTRUCTION 虚拟世界中身份认同的建立 part 2
- 论文伪代码规范,伪代码在线编辑器,
- Unity audio visualization scheme
- Focusing on the industry, enabling customers | release of solutions for the five industries of the cloud container cloud product family
猜你喜欢

vs在连接SQL时出现的问题myconn.OPen();无法运行

【云计算赛项】职业技能竞赛--容器开发部分例题Pig快速开发框架

利用for循环输出一个字母三角形

这道字符串反转的题目,你能想到更好的方法吗?

在线JSON转CSharp(C#)Class工具

The eighth experiment of hcip Road

Playwirght深度入门

帆软堆积图显示占比

Make a record of glib2.14 upgrading glib2.18 and the principle of the steps

Abnormal logic reasoning problem of Huawei software test written test
随机推荐
链游飞船开发 农民世界链游开发 土地链游开发
Playwirght getting started
Analysis of open API design specification
跳跃表原理
[deep learning] [original] how to detect targets and draw map and other parameter maps without yolov5 weights or models
帆软堆积图显示占比
传智教育 | 多人协作开发出现代码冲突,如何合并代码?
Solutions to abnormal network connection of Xiaoai speakers
Online text filter less than specified length tool
30 sets of report templates necessary for the workplace, meeting 95% of the report needs, and no code is required for one click application
YGG Spain subdao Ola GG officially established
传智教育 | 项目发布前如何打tag标签及标签命名规范
Vs problems when connecting to SQL myconn OPen(); cannot execute
Product axure9 (English version), prototype design background dynamic secondary menu display content
Simpledateformat thread safety issues
Console Application
Here comes the dry goods | PAAS collection to see first ~
unity 音频可视化方案
浅析 Open API 设计规范
Data types in tensorflow