当前位置:网站首页>Acwing第 57 场周赛【未完结】
Acwing第 57 场周赛【未完结】
2022-06-27 22:01:00 【辉小歌】
懒了,只做俩题。第三题懒的看了
https://www.acwing.com/activity/content/competition/problem_list/1974/
4485. 比大小
#include<bits/stdc++.h>
using namespace std;
const int N=1e5*5+10;
typedef long long int LL;
LL n,m,s1,s2,a[N],b[N];
int main(void)
{
cin>>n;
for(int i=1;i<=n;i++) cin>>a[i],s1+=a[i];
for(int i=1;i<=n;i++) cin>>b[i],s2+=b[i];
if(s1>=s2) puts("Yes");
else puts("No");
return 0;
}
4486. 数字操作【数学】

数学题,刚开始以为dfs或者最短路建图可做。后来一想就是数学思维题。
经过操作后最小的数一定是这些质数因子的乘积,那么关键问题就是在于求次数。
#include<bits/stdc++.h>
using namespace std;
void solve()
{
int n; cin>>n;
if(n==1)
{
puts("1 0");
return;
}
vector< pair<int,int> >ve;
int ans=1,cnt=0,flag=0,maxv=0;
for(int i=2;i<=n/i;i++)
{
int s=0;
while(n%i==0) s++,n/=i;
if(s) ve.push_back({
i,s}),ans*=i;
}
if(n!=1) ve.push_back({
n,1}),ans*=n;
map<int,int>mp,st;
for(int i=1;i<=25;i++) mp[pow(2,i)]++;
for(int i=0;i<ve.size();i++)
{
st[ve[i].second]++;
if(!mp[ve[i].second]) flag=1;//不是 2,4,8这种数
maxv=max(maxv,ve[i].second);
}
for(int i=1;i<=25;i++)
{
if(pow(2,i)>=maxv)
{
cnt=i;
break;
}
}
if(st.size()!=1) flag=1;//数的种类多于1
if(maxv==1) cout<<ans<<" "<<0<<endl;//已经是最简的了
else cout<<ans<<" "<<cnt+flag;
}
int main(void)
{
solve();
return 0;
}
边栏推荐
- [microservices sentinel] sentinel data persistence
- Deployment and test of crtmp live video server
- [AI application] detailed parameters of NVIDIA Tesla v100s-pcie-32gb
- SQL报了一个不常见的错误,让新来的实习生懵了
- Solve the cross domain problem of the new version of chrome: Cookie loss and samesite attribute problem "recommended collection"
- NDSS 2022 received list
- Pytorch Foundation (1)
- 华泰证券在网上开户安全吗?
- [AI application] detailed parameters of NVIDIA geforce RTX 3060
- Redis主从复制、哨兵模式、集群的概述与搭建
猜你喜欢
![[untitled]](/img/e4/7c65c6823559b8501a1777cc4eb7ba.jpg)
[untitled]

zotero文献管理工具安装使用

Alchemy (7): how to solve problems? Only reconstruction
![软件工程作业设计(1): [个人项目] 实现一个日志查看页面](/img/95/0c3f0dde16d220ddecb5758a4c31e7.png)
软件工程作业设计(1): [个人项目] 实现一个日志查看页面

Summary of wuenda's machine learning course (11)_ Support vector machine

【无标题】

Arduino uno realizes simple touch switch through direct detection of capacitance

Squid代理服务器(缓存加速之Web缓存层)

现代编程语言:Rust (铁锈,一文掌握钢铁是怎样生锈的)
![Software engineering job design (1): [personal project] implements a log view page](/img/95/0c3f0dde16d220ddecb5758a4c31e7.png)
Software engineering job design (1): [personal project] implements a log view page
随机推荐
代码整洁之道--格式
Pytorch Foundation (1)
数仓的字符截取三胞胎:substrb、substr、substring
股票投资交流群安全吗?入群免费开户靠谱嘛?
RNA SEQ introduction practice (I): upstream data download, format conversion and quality control cleaning
SCU|通过深度强化学习进行微型游泳机器人的步态切换和目标导航
Differences and functions between intranet IP and public IP
[untitled]
Promise是什么
Deployment and test of crtmp live video server
炼金术(9): 简约而不简单,永不停歇的测试 -- always_run
Redis主从复制、哨兵模式、集群的概述与搭建
At the beginning of reading English literature, I would like to ask you how you should read it in the first place?
免费、好用、强大的开源笔记软件综合评测
Code neatness -- function
Oracle数据库的启停
Hcip/hcie Routing & Switching / datacom Reference Dictionary Series (19) comprehensive summary of PKI knowledge points (public key infrastructure)
MySQL read / write separation configuration
How to use raspberry pie (and all kinds of pies)
本地可视化工具连接阿里云centOS服务器的redis