当前位置:网站首页>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;
}
边栏推荐
- [黑苹果系列] M910x完美黑苹果系统安装教程 – 2 制作系统U盘-USB Creation
- #795 Div.2 E. Number of Groups set *
- 1696D. Permutation graph thinking
- LabVIEW continuous sampling and limited sampling mode
- Arduino uno realizes simple touch switch through direct detection of capacitance
- plot_ Model error: pydot and graphviz are not installed
- 软件工程作业设计(1): [个人项目] 实现一个日志查看页面
- IIC communication protocol for single chip microcomputer
- C语言malloc函数的功能及用法
- 认识微信小程序项目的基本组成结构
猜你喜欢

Arduino uno realizes simple touch switch through direct detection of capacitance

【无标题】

炼金术(1): 识别项目开发中的ProtoType、Demo、MVP

Sword finger offer 61 Shunzi in playing cards

A summer party

吴恩达《机器学习》课程总结(14)_降维

Leetcode 720. The longest word in the dictionary

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

【论文阅读|深读】SDNE:Structural Deep Network Embedding

Summary of wuenda's machine learning course (14)_ Dimensionality reduction
随机推荐
plot_model报错:没有安装pydot, graphviz
代码整洁之道--格式
MYSQL的下载与配置安装
Logging log usage
HCIP/HCIE Routing&Switching / Datacom备考宝典系列(十九)PKI知识点全面总结(公钥基础架构)
一个人可以到几家证券公司开户?开户安全吗
NoSQL之Redis配置与优化
Learning notes for qstringlist
1696D. Permutation graph thinking
Summary of wuenda's machine learning course (11)_ Support vector machine
QStringList 的学习笔记
MATLB|改进的前推回代法求解低压配电网潮流
zotero文献管理工具安装使用
LabVIEW continuous sampling and limited sampling mode
TIME_ Solutions to excessive wait
Flutter series: Transformers in flutter
Alchemy (1): identify prototype, demo and MVP in project development
Request object, response object, session object
#795 Div.2 D. Max GEQ Sum 单调栈
Mongodb- install a mongodb database locally on the windows computer