当前位置:网站首页>Acwing game 57 [unfinished]
Acwing game 57 [unfinished]
2022-06-28 00:38:00 【Hui Xiaoge】
I'm lazy , Just two questions . The third question I read lazily
https://www.acwing.com/activity/content/competition/problem_list/1974/
4485. Than the size
#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. Digital operation 【 mathematics 】

mathematical problem , At first I thought dfs Or the shortest path mapping can be done . Later, I thought it was a mathematical thinking problem .
The smallest number after operation must be the product of these prime factors , So the key problem is to find the number of times .
#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;// No 2,4,8 This number
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;// There are more kinds of numbers than 1
if(maxv==1) cout<<ans<<" "<<0<<endl;// It is already the simplest
else cout<<ans<<" "<<cnt+flag;
}
int main(void)
{
solve();
return 0;
}
边栏推荐
- 股市小白在网上股票开户安全吗?
- SDF学习之扭曲模型
- LabVIEW continuous sampling and limited sampling mode
- Comprehensive evaluation of free, easy-to-use and powerful open source note taking software
- Flutter series: Transformers in flutter
- Distortion model of SDF learning
- 什么是cookie,以及v-htm的安全性隐患
- 免费、好用、强大的开源笔记软件综合评测
- 云原生运维文章计划
- MYSQL的下载与配置安装
猜你喜欢
![[读书摘要] 学校的英文阅读教学错在哪里?--经验主义和认知科学的PK](/img/7b/8b3619d7726fdaa58da46b0c8451a4.png)
[读书摘要] 学校的英文阅读教学错在哪里?--经验主义和认知科学的PK

夏日的晚会

Modern programming languages: zig

Mongodb- install a mongodb database locally on the windows computer

Alchemy (1): identify prototype, demo and MVP in project development

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

Sword finger offer 65 Add without adding, subtracting, multiplying, dividing
![[paper reading | deep reading] sdne:structural deep network embedding](/img/6a/b2edf326f6e7ded83deb77219654aa.png)
[paper reading | deep reading] sdne:structural deep network embedding

LabVIEW continuous sampling and limited sampling mode

Squid代理服务器(缓存加速之Web缓存层)
随机推荐
[untitled]
plot_model报错:没有安装pydot, graphviz
795 div.2 D. Max GEQ sum monotone stack
Is it safe for Huatai Securities to open an account online?
Customize MySQL connection pool
吴恩达《机器学习》课程总结(14)_降维
Promise是什么
Modern programming language: rust
Arduino UNO通过电容的直接检测实现简易触摸开关
mysql数据库旅游管理系统_JSP+MySQL基于ssm的旅游管理系统[通俗易懂]
单片机之IIC通信协议「建议收藏」
A summer party
投资场内ETF基金是靠谱吗,场内ETF基金安全吗
Squid代理服务器(缓存加速之Web缓存层)
Is it safe to open a new bond registration account? Is there any risk?
认识微信小程序项目的基本组成结构
Scu| gait switching and target navigation of micro swimming robot through deep reinforcement learning
Sword finger offer 65 Add without adding, subtracting, multiplying, dividing
Alchemy (1): identify prototype, demo and MVP in project development
云原生运维文章计划