当前位置:网站首页>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;
}
边栏推荐
- Alchemy (9): simple but not simple, never-ending test -- always_ run
- Matlb| improved forward push back method for solving power flow of low voltage distribution network
- Thread pool implementation: semaphores can also be understood as small waiting queues
- 1696D. Permutation Graph 思维
- Why are cloud vendors targeting this KPI?
- SQL reported an unusual error, which confused the new interns
- logging日志的使用
- Summary of wuenda's machine learning course (11)_ Support vector machine
- 炼金术(3): 怎样做好1个业务流程的接口对接
- 现代编程语言:zig
猜你喜欢

Promise是什么

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

数仓的字符截取三胞胎:substrb、substr、substring

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

LabVIEW连续采样与有限采样模式

夏日的晚会

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

深入解析kubernetes controller-runtime

剑指 Offer 65. 不用加减乘除做加法

MySQL enterprise parameter tuning practice sharing
随机推荐
Customize MySQL connection pool
数据仓库入门介绍
What are the ways to combine the points system with marketing activities
【无标题】
炼金术(3): 怎样做好1个业务流程的接口对接
吴恩达《机器学习》课程总结(11)_支持向量机
[黑苹果系列] M910x完美黑苹果系统安装教程 – 2 制作系统U盘-USB Creation
Recyclerview implements grouping effects in a variety of ways
On charsequence
796 div.2 C. managing history thinking
Software engineering job design (1): [personal project] implements a log view page
[black apple series] m910x perfect black apple system installation tutorial – 2 making system USB disk -usb creation
Learning notes for qstringlist
Redis主从复制、哨兵模式、集群的概述与搭建
Why are cloud vendors targeting this KPI?
Quickly master grep commands and regular expressions
How many securities companies can a person open an account? Is it safe to open an account
自定义MySQL连接池
Mise en œuvre du pool de Threads: les sémaphores peuvent également être considérés comme de petites files d'attente
Comprehensive evaluation of free, easy-to-use and powerful open source note taking software