当前位置:网站首页>Acwing第 56 场周赛【完结】
Acwing第 56 场周赛【完结】
2022-06-23 07:16:00 【辉小歌】
https://www.acwing.com/activity/content/competition/problem_list/1939/
4482. 分组

#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. 格斗场

#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. 有限小数【思维】

q整除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;
}
边栏推荐
- Abnormal logic reasoning problem of Huawei software test written test
- MySQL获取系统时间段
- Download the OSS file and modify the file name
- How to solve CSRF attack in laravel
- Matlab随机波动率SV、GARCH用MCMC马尔可夫链蒙特卡罗方法分析汇率时间序列
- 20bn Jester complete dataset Download
- Decoding and practice of cmaf Technology
- 3dmax插件开发环境配置及FileExport和Utilities模板测试
- Cirium has gradually become the standard for airlines' carbon dioxide emission reporting
- Basic experiment of data statistics and analysis - basic grammar and operation
猜你喜欢

Live broadcast review | how can the container transformation of traditional applications be fast and stable?

How to tag and label naming before the project release

Hcip Road

ArcMap批量删除距离较近的点

HCIP之路第八次实验

Data types in tensorflow

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

MySQL (IV) - MySQL storage engine

浅谈ThreadLocal和InheritableThreadLocal,源码解析

The sandbox has reached a cooperation with football player to bring popular football cartoons and animation into the metauniverse
随机推荐
openni.utils.OpenNIError: (OniStatus.ONI_STATUS_ERROR, b‘DeviceOpen using default: no devices found‘
RTMP streaming exception fast recovery scheme
Unity图片加载和保存
数学知识:快速幂求逆元—快速幂
Make a record of glib2.14 upgrading glib2.18 and the principle of the steps
快速删除代码里面的node_modules
电脑如何安装MySQL?
[2022 graduation season] from graduation to transition to the workplace
three. Solution to stripe shadow and grid shadow in JS
Online text filter less than specified length tool
[cloud computing event] vocational skill competition -- container development example pig rapid development framework
Download the OSS file and modify the file name
Wechat multiplayer chat and Roulette Games (websocket Implementation)
Yan's DP analysis
Nacos adapts Oracle11g create table DDL statement
Decoding and practice of cmaf Technology
分布式ID生成
Qt 使用QDomDocument读取xml文件
Intelligence Education - how to merge codes when code conflicts occur in multi person collaborative development?
【Veusz】导入CSV中的二维数据