当前位置:网站首页>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;
}
边栏推荐
- 剑指 Offer 61. 扑克牌中的顺子
- SQL reported an unusual error, which confused the new interns
- Sécurité, économie de carburant et protection de l'environnement chameau
- MySQL read / write separation configuration
- 吴恩达《机器学习》课程总结(13)_聚类
- [黑苹果系列] M910x完美黑苹果系统安装教程 – 2 制作系统U盘-USB Creation
- VirtualBox extended dynamic disk size pit
- Is it safe for Huatai Securities to open an account online?
- Learning notes for qstringlist
- [microservices sentinel] sentinel data persistence
猜你喜欢

Instructions for vivado FFT IP

炼金术(7): 何以解忧,唯有重构
![Count prime [enumeration - > space for time]](/img/11/c52e1dfce8e35307c848d12ccc6454.png)
Count prime [enumeration - > space for time]

Webserver flow chart -- understand the calling relationship between webserver modules

MATLB|基于复杂网络的配电系统微电网优化配置

Modern programming language: rust
![[microservices sentinel] sentinel data persistence](/img/9f/2767945db99761bb35e2bb5434b44d.png)
[microservices sentinel] sentinel data persistence

赛尔笔记|视频文本预训练简述

MySQL分表查询之Merge存储引擎实现

Promise是什么
随机推荐
Logging log usage
剑指 Offer 65. 不用加减乘除做加法
Learning notes for qstringlist
Alchemy (7): how to solve problems? Only reconstruction
Chenyun pytorch learning notes_ Build RESNET with 50 lines of code
HCIP/HCIE Routing&Switching / Datacom备考宝典系列(十九)PKI知识点全面总结(公钥基础架构)
internship:业务流程初识
[digital ic/fpga] detect the position of the last matching sequence
[AI application] detailed parameters of NVIDIA Tesla v100-pcie-32gb
[idea] idea formatting code skills
The development of the Internet provides new solutions for industrial transformation
Differences and functions between intranet IP and public IP
Technical debt wall: a way to make technical debt visible and negotiable
Introduction to data warehouse
Scu| gait switching and target navigation of micro swimming robot through deep reinforcement learning
Summary of wuenda's machine learning course (11)_ Support vector machine
智慧风电 | 图扑软件数字孪生风机设备,3D 可视化智能运维
How to quote Chinese documents when writing a foreign language?
股票投资交流群安全吗?入群免费开户靠谱嘛?
Using two stacks to implement queues [two first in first out is first in first out]