当前位置:网站首页>Acwing game 56 [End]
Acwing game 56 [End]
2022-06-23 07:48:00 【Hui Xiaoge】
https://www.acwing.com/activity/content/competition/problem_list/1939/
4482. grouping

#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. The arena

#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. terminating decimal 【 thinking 】

q to be divisible by b^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 bootstrap clears floating styles

跳跃表原理

The sandbox has reached a cooperation with football player to bring popular football cartoons and animation into the metauniverse

The Sandbox 与《足球小将》达成合作,将流行的足球漫画及动画带入元宇宙
![[pyqt5 series] modify the counter to realize control](/img/de/c997a19ad72619b0fd2fcd0124ee1a.png)
[pyqt5 series] modify the counter to realize control

聊聊服务治理中的路由设计

Deploy kubersphere in kubernetes

EXCEL VBA 入门与实用例子

1278_FreeRTOS_借助prvAddCurrentTaskToDelayedList接口理解delayed task

MySQL on duplicate key and PgSQL on conflict (primary key) handle primary key conflicts
随机推荐
帆软堆积图显示占比
Test APK exception control nettraffic attacker development
Ntu-rgbd data set download and data format analysis
[interface automation] software testing the core skills of salary increase to increase salary by 200%
Solutions to abnormal network connection of Xiaoai speakers
测试apk-异常管控NetTraffic攻击者开发
1. probability theory - combination analysis
RTMP streaming exception fast recovery scheme
左乘右乘矩阵问题
Eureka service registration and discovery
Unity图片加载和保存
. H5 file forgets the database name and uses h5py to print
MySQL慢查询记录
干货来了|《PaaS》合辑抢先看~
1.概率论-组合分析
【星球精选】如何高效构建 Roam 与 theBrain 间细粒度双向链接?
快速排序 + 冒泡排序 + 插入排序 + 選擇排序
Playwirght深度入门
[深度学习][原创]如何不用yolov5权重或者模型进行目标检测和绘制map等参数图
Abnormal logic reasoning problem of Huawei software test written test