当前位置:网站首页>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;
}
边栏推荐
- 快速掌握grep命令及正则表达式
- MySQL分表查询之Merge存储引擎实现
- 炼金术(7): 何以解忧,唯有重构
- Quickly master grep commands and regular expressions
- [PCL self study: pclplotter] pclplotter draws data analysis chart
- Matlb| improved forward push back method for solving power flow of low voltage distribution network
- [PCL self study: Segmentation3] PCL based point cloud segmentation: region growth segmentation
- 一个人可以到几家证券公司开户?开户安全吗
- Chapter 2 integrated mp
- 数仓的字符截取三胞胎:substrb、substr、substring
猜你喜欢

Alchemy (7): how to solve problems? Only reconstruction

MATLB|改进的前推回代法求解低压配电网潮流

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

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

Summary of wuenda's machine learning course (11)_ Support vector machine
![[Reading Abstract] what is wrong with English Reading Teaching in schools-- Empiricism and the PK of cognitive science](/img/7b/8b3619d7726fdaa58da46b0c8451a4.png)
[Reading Abstract] what is wrong with English Reading Teaching in schools-- Empiricism and the PK of cognitive science

Sell notes | brief introduction to video text pre training

Local visualization tool connects to redis of Alibaba cloud CentOS server
![[PCL self study: Segmentation3] PCL based point cloud segmentation: region growth segmentation](/img/9e/f08ce0729c89b0205c0ac47c523ad7.png)
[PCL self study: Segmentation3] PCL based point cloud segmentation: region growth segmentation

MySQL企业级参数调优实践分享
随机推荐
TIME_ Solutions to excessive wait
TIME_WAIT过多的解决办法
Chapter 2 integrated mp
SQL报了一个不常见的错误,让新来的实习生懵了
Systematic learning + active exploration is the most comfortable way to get started!
Arduino uno realizes simple touch switch through direct detection of capacitance
Build an open source and beautiful database monitoring system -lepus
Introduction to data warehouse
供应链高效管理供应商
Mysql database tourism management system_ Jsp+mysql tourism management system based on SSM [easy to understand]
How to use raspberry pie (and all kinds of pies)
Character interception triplets of data warehouse: substrb, substr, substring
logging日志的使用
CharSequence初探
Squid代理服务器(缓存加速之Web缓存层)
mysql数据库旅游管理系统_JSP+MySQL基于ssm的旅游管理系统[通俗易懂]
Promise是什么
Logging log usage
[AI application] detailed parameters of NVIDIA geforce RTX 1080ti
炼金术(9): 简约而不简单,永不停歇的测试 -- always_run