当前位置:网站首页>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;
}
边栏推荐
- zotero文献管理工具安装使用
- [VIM] tutorial, common commands, efficient use of vim editor
- 炼金术(4): 程序员的心智模型
- RNA-seq入门实战(一):上游数据下载、格式转化和质控清洗
- 吴恩达《机器学习》课程总结(11)_支持向量机
- MySQL read / write separation configuration
- Solve the cross domain problem of the new version of chrome: Cookie loss and samesite attribute problem "recommended collection"
- MYSQL的下载与配置安装
- How to find Chinese documents corresponding to foreign documents?
- Alchemy (1): identify prototype, demo and MVP in project development
猜你喜欢

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

Arduino UNO通过电容的直接检测实现简易触摸开关

Msp430f5529 MCU reads gy-906 infrared temperature sensor

剑指 Offer 61. 扑克牌中的顺子

zotero文献管理工具安装使用

Comprehensive evaluation of free, easy-to-use and powerful open source note taking software
![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

技术的极限(11): 有趣的编程

Hcip/hcie Routing & Switching / datacom Reference Dictionary Series (19) comprehensive summary of PKI knowledge points (public key infrastructure)

Safe, fuel-efficient and environment-friendly camel AGM start stop battery is full of charm
随机推荐
100 questions for an enterprise architect interview
Recyclerview implements grouping effects in a variety of ways
Matlb| improved forward push back method for solving power flow of low voltage distribution network
線程池實現:信號量也可以理解成小等待隊列
Sell notes | brief introduction to video text pre training
Code neatness -- format
Deployment and test of crtmp live video server
Sentinel
MySQL分表查询之Merge存储引擎实现
Startup and shutdown of Oracle Database
C语言malloc函数的功能及用法
[AI application] detailed parameters of NVIDIA Tesla v100s-pcie-32gb
CRTMP视频直播服务器部署及测试
积分体系和营销活动结合在一起有哪些玩法
Quickly master grep commands and regular expressions
2022 PMP project management examination agile knowledge points (3)
数据仓库入门介绍
MySQL enterprise parameter tuning practice sharing
每次启动项目的服务,电脑竟然乖乖的帮我打开了浏览器,100行源码揭秘!
How to find Chinese documents corresponding to foreign documents?