当前位置:网站首页>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;
}
边栏推荐
- 1. probability theory - combination analysis
- 【PyQt5系列】修改计数器实现控制
- 测试apk-异常管控NetTraffic攻击者开发
- MySQL慢查询记录
- MIT CMS.300 Session 12 – IDENTITY CONSTRUCTION 虚拟世界中身份认同的建立 part 2
- What is distributed?
- 某年某月某公司的面试题(1)
- How MySQL converts a date to a number
- QT reading XML files using qdomdocument
- Online text filter less than specified length tool
猜你喜欢

20bn Jester complete dataset Download

30 sets of report templates necessary for the workplace, meeting 95% of the report needs, and no code is required for one click application

Online text filter less than specified length tool

Eureka服务注册与发现

EXCEL VBA 入门与实用例子

小爱音箱连接网络异常解决办法

Online JSON to CSharp (c) class tool
![[veusz] import 2D data in CSV](/img/22/467139f5a83ce9e88a57ced732d4d6.png)
[veusz] import 2D data in CSV

How MySQL converts a date to a number

Matlab随机波动率SV、GARCH用MCMC马尔可夫链蒙特卡罗方法分析汇率时间序列
随机推荐
1.概率论-组合分析
1. probability theory - combination analysis
leetcode210. Schedule II 207 Curriculum topology sorting DFS BFS
Principle of skip table
MIT CMS.300 Session 12 – IDENTITY CONSTRUCTION 虚拟世界中身份认同的建立 part 2
Deploy kubersphere in kubernetes
Ldconfig command
MySQL获取系统时间段
Friends of the week
. H5 file forgets the database name and uses h5py to print
一篇文章学会er图绘制
MySQL慢查询记录
Simpledateformat thread safety issues
Quick sort + bubble sort + insert sort + select sort
Tri rapide + Tri par bulle + Tri par insertion + Tri par sélection
传智教育 | 多人协作开发出现代码冲突,如何合并代码?
这道字符串反转的题目,你能想到更好的方法吗?
What is customer experience automation?
Yolov5 detecting small targets (with source code)
The sandbox has reached a cooperation with football player to bring popular football cartoons and animation into the metauniverse