国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

牛客競賽題目講解_孤獨的樹

2022-05-01 10:37 作者:Clayton_Zhou  | 我要投稿

// https://ac.nowcoder.com/acm/contest/11225/F


#include "stdafx.h"

//#include <bits/stdc++.h>

#include <algorithm>

#include <iostream>

#include <cstring>

?#include <vector>



using namespace std;

int n,i,j;

?

int a[100005]={0,32,2,2,2,2};

int edge[32][2]={

1, 2,

1, 3,

1, 4,

1,5

};


vector<int> v[100005];

int ans;

?int gcd(int a,int b)

{? ??

? ? if(a%b==0)?

? ? return b;? ? ? ??

? ? else return (gcd(b,a%b));

}

int pcount(int t)

{

if(t==1)return 0;

int pc=0;?

? for(int i=2;t>1;i++)? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? while(t%i==0)t/=i,pc++;? ?? ? ??

? return pc;

}

void dfs(int x,int fa){

? ? for(int y:v[x])if(y!=fa){

? ? ? ? dfs(y,x);

? ? ? ? int t=gcd(a[x],a[y]);

? ? ? ? ans+=pcount(t);

? ? ? ? a[x]/=t;

cout<<" a[x]="<<a[x]<<"? t="<<t<<endl;

? ? }

}

int main()

{

n=5;

? ? //cin>>n;

? ?// for(int i=1;i<=n;i++)cin>>a[i];?

? ? for(int i=1;i<n;i++){

? ? ? ? int x,y;

x=edge[i-1][0];

y=edge[i-1][1];

? ? ? ? //cin>>x>>y;

? ? ? ? v[x].push_back(y);

? ? ? ? v[y].push_back(x);

? ? }

? ? ?dfs(1,0);

? ? cout<<ans<<endl;

? ? return 0;

}


??透傎愵}目講解_孤獨的樹的評論 (共 條)

分享到微博請遵守國家法律
谢通门县| 栾川县| 开远市| 汉沽区| 历史| 英德市| 乐陵市| 永泰县| 临桂县| 沈丘县| 龙陵县| 浦县| 麻栗坡县| 灌阳县| 兴化市| 阿拉善右旗| 望奎县| 乌拉特前旗| 沛县| 朝阳区| 黎城县| 长海县| 交口县| 东海县| 平安县| 沅江市| 竹溪县| 寿光市| 新河县| 永吉县| 宣城市| 中江县| 青冈县| 宜都市| 南雄市| 二连浩特市| 财经| 榆树市| 大关县| 格尔木市| 嵊州市|