当前位置: 首页 > news >正文

外贸seo网站搭建爱站网怎么使用

外贸seo网站搭建,爱站网怎么使用,wordpress 浮框,深圳龙华疫情最新消息今天A.手玩题&#xff1a; 可以通过最后一个样例&#xff0c;如果是长度为3的连续O&#xff0c;直接在两边放就行&#xff0c;然后一直用中间的水填到其他地方 #include<bits/stdc.h> using namespace std; const int N 3e510,mod 998244353; #define int long long int n…

A.手玩题:

可以通过最后一个样例,如果是长度为3的连续O,直接在两边放就行,然后一直用中间的水填到其他地方

#include<bits/stdc++.h>
using namespace std;
const int N = 3e5+10,mod= 998244353;
#define int long long
int n,m,k;void solve()
{cin>>n;string s;cin>>s;s="?"+s;int res=0;int now=0;s+="#";for(int i=1;i<=n+1;i++){if(s[i]=='#'){if(now>=3){cout<<2<<"\n";return ;}res+=min(2ll,now);now=0;}else now++;}cout<<res<<"\n";
}signed main()
{cin.tie(0);cout.tie(0);ios::sync_with_stdio(0);int t=1;cin>>t;while(t--) solve();
}

B:

直接每个数字都去判定能不能成为最后一个

假设都变成 a

然后目标变成 让 b c的数量相同

假设只操作b c,那么他们的差都减一,差奇偶性不变

如果操作a c或者a b,那么他们的差还是不变,因为-b -a ,+c,差变化2

所以如果差是奇数没法操作,

再想一下,那么对a的数量有没有啥要求呢

可以发现没要求,

因为b c可以操作自己变出一个a,然后再用 a去操作自己,他们可以独立自主

#include<bits/stdc++.h>
using namespace std;
const int N = 3e5+10,mod= 998244353;
#define int long long
int n,m,k;void solve()
{int a,b,c;auto ok=[&](int a,int b,int c){int need=abs(b-c);if(need%2==0) return true;return false;};cin>>a>>b>>c;if(ok(a,b,c)) cout<<"1 ";else cout<<"0 "; if(ok(b,a,c)) cout<<"1 ";else cout<<"0 "; if(ok(c,a,b)) cout<<"1 ";else cout<<"0 "; cout<<"\n";
}signed main()
{cin.tie(0);cout.tie(0);ios::sync_with_stdio(0);int t=1;cin>>t;while(t--) solve();
}

C:

感觉很裸的dp

dp状态:通过u这个子树到达叶子节点的最少次数

那么如果是叶子节点无需代价

如果不是叶子节点,判断走的左右子树的方向和当前根方向是否相同,不同代价+1

#include<bits/stdc++.h>
using namespace std;
const int N = 3e5+10,mod= 998244353;
#define int long long
typedef long long LL;
typedef pair<int, char> PII;int n,m,k;
string s;
vector<PII> g[N];
int f[N];
void dfs(int u){//if(s[u]=='U') f[u]=1;if(g[u].empty()){f[u]=0;return ;}for(auto [v,w]:g[u]){dfs(v);f[u]=min(f[u],f[v]+(w!=s[u]));}
}
void solve()
{cin>>n>>s;s="?"+s;for(int i=1;i<=n;i++){g[i].clear();f[i]=2e18;}for(int i=1;i<=n;i++){int a,b;cin>>a>>b;if(a) g[i].emplace_back(a,'L');if(b) g[i].emplace_back(b,'R');}dfs(1);cout<<f[1]<<"\n";
}signed main()
{cin.tie(0);cout.tie(0);ios::sync_with_stdio(0);int t=1;cin>>t;while(t--) solve();
}

D:

首先先排序,排序不影响答案

然后问题变成了

当前数(a[i]和前面数的gcd之和)*后面的个数(就是k嘛)

然后难点是前面

我们可以分开求a[x]的因数的贡献,

通过一个调和级数求1到10w的每个数的因子(不是质因子哦,而是因子,比如16的因子有1 2 4 8 16)

然后a[i]和前面数因子的贡献计算

这里举例说明一下

假设

a[i]=20 a[j]=4

a[i]的因子有 1 2 4 510 20 

a[j]因子有 1 2 4

那么他们gcd的贡献是gcd(20,4)=4

直接求他们里面最大的共同的的因子不好求(n^2超时间嘛)

但是我们知道每个数的因子最多就128个? n*128够了

然后我们可以求当前数的当前因子能和前面数的因子的总贡献

比如上面例子的1和1配对 2和2配对 4和4配对

但是注意到我们贡献其实只有一个4

那么咋办呢可以用容斥来解决

4的因子里面有2 1

2的因子有1

1的因子只有自己

所以我们求完后还要减去这个因子的倍数

设当前数组f[x]表示因子x有多少个(i,j)的对数

根据上面那个例子a[i]=20 a[j]=4

f[4]=1 f[2]=1 f[1]=1(因为只有两个数嘛,所以只有一对)

然后计算完这个f数组,我们要用容斥减去当前x的倍数的对数

比如上面例子的f[2]要减去f[4]  f[1]要减去f[1]减去f[2]减去f[4](这里的f[2]要先减去f[4]哦)

然后当前f[x]数组就是名副其实的因子是x的对数

#include<bits/stdc++.h>
using namespace std;
const int N = 1e5+10,mod= 998244353;
#define int long long
typedef long long LL;
typedef pair<int, char> PII;int n,m,k;
int a[N];
vector<int> g[N];
int gcd(int a,int b){return b?gcd(b,a%b):a;
}
void init(){for(int i=1;i<N;i++){for(int j=i;j<N;j+=i){g[j].push_back(i);}}
}
void solve()
{cin>>n;for(int i=1;i<=n;i++){cin>>a[i];}sort(a+1,a+1+n);vector<int> c(N),f(N);for(int i=1;i<=n;i++){for(auto x:g[a[i]]){f[x]+=c[x]*(n-i);c[x]++;}}int res=0;for(int i=100000;i>=1;i--){for(int j=i+i;j<=100000;j+=i){f[i]-=f[j];}res+=f[i]*i;}cout<<res<<"\n";
}signed main()
{cin.tie(0);cout.tie(0);ios::sync_with_stdio(0);int t=1;init();cin>>t;while(t--) solve();
}

E:

手完可以发现如果是强联通分量最后会变成一个有向完全图

代表着如果进来了,因为要求路径最长,所以这个强联通分量的点都要走一遍且保证点不重复,

然后直接dp一下即可

然后因为是拓扑序大的 scc_cnt小,因为tarjan是先到底部的,底部的点会先缩,再回溯到上面缩,所以dp直接从1开始即可

#include<bits/stdc++.h>
using namespace std;
const int N = 3e5+10,mod= 998244353;
#define int long long
typedef long long LL;
typedef pair<int, char> PII;int n,m,k;vector<int> g[N],h[N];
int dfn[N],low[N];
int scc_cnt,timestamp;
int stk[N],id[N];
bool in_stk[N];
int sz[N];
int top;
stack<int> s;
int b[N],a[N],c[N],f[N],gg[N];
void tarjan(int u){dfn[u] = low[u] = ++ timestamp;stk[ ++ top] = u, in_stk[u] = true;for (auto j:g[u]){if (!dfn[j]){tarjan(j);low[u] = min(low[u], low[j]);}else if (in_stk[j]) low[u] = min(low[u], dfn[j]);}if (dfn[u] == low[u]){++ scc_cnt;int y;do {y = stk[top -- ];in_stk[y] = false;id[y] = scc_cnt;} while (y != u);}}
void solve()
{cin>>n>>m;scc_cnt=timestamp=top=0;for(int i=0;i<=n;i++){g[i].clear();dfn[i]=low[i]=0;in_stk[i]=false;h[i].clear();id[i]=b[i]=c[i]=0;f[i]=gg[i]=0;}for(int i=1;i<=n;i++) cin>>a[i];for(int i=1;i<=m;i++){int a,b;cin>>a>>b;g[a].push_back(b);}for(int i=1;i<=n;i++){if(!dfn[i])tarjan(i);}for(int i=1;i<=n;i++){b[id[i]]+=a[i];c[id[i]]++;}for(int u=1;u<=n;u++){//cout<<id[u]<<" ";for(auto v:g[u]){if(id[u]!=id[v]){h[id[u]].push_back(id[v]);}}}int ans1=0,ans2;for(int i=1;i<=scc_cnt;i++){f[i]=c[i],gg[i]=b[i];for(auto j:h[i]){int t1=f[j]+c[i],t2=gg[j]+b[i];if(t1>f[i]||t1==f[i]&&t2<gg[i]){f[i]=t1,gg[i]=t2;}}if (f[i] > ans1 || f[i] == ans1 && gg[i] < ans2) ans1 = f[i], ans2 = gg[i];}cout<<ans1<<" "<<ans2<<"\n";
}signed main()
{cin.tie(0);cout.tie(0);ios::sync_with_stdio(0);int t=1;cin>>t;while(t--) solve();
}


文章转载自:
http://masturbatory.Lnnc.cn
http://invite.Lnnc.cn
http://autotype.Lnnc.cn
http://banausic.Lnnc.cn
http://flattish.Lnnc.cn
http://denicotinize.Lnnc.cn
http://riskless.Lnnc.cn
http://tenebrious.Lnnc.cn
http://upward.Lnnc.cn
http://crossway.Lnnc.cn
http://setae.Lnnc.cn
http://vasoligate.Lnnc.cn
http://whomso.Lnnc.cn
http://bearably.Lnnc.cn
http://patripotestal.Lnnc.cn
http://euclid.Lnnc.cn
http://orthodoxy.Lnnc.cn
http://cagm.Lnnc.cn
http://hiccupy.Lnnc.cn
http://wourali.Lnnc.cn
http://tartarean.Lnnc.cn
http://polestar.Lnnc.cn
http://lacune.Lnnc.cn
http://destocking.Lnnc.cn
http://gasdynamics.Lnnc.cn
http://capitoline.Lnnc.cn
http://sawhorse.Lnnc.cn
http://solenocyte.Lnnc.cn
http://cero.Lnnc.cn
http://telodynamic.Lnnc.cn
http://molehill.Lnnc.cn
http://freer.Lnnc.cn
http://provascular.Lnnc.cn
http://bedeck.Lnnc.cn
http://saliva.Lnnc.cn
http://uncircumstantial.Lnnc.cn
http://impassible.Lnnc.cn
http://satyric.Lnnc.cn
http://favonian.Lnnc.cn
http://correlativity.Lnnc.cn
http://staphylococcal.Lnnc.cn
http://vilify.Lnnc.cn
http://appetizer.Lnnc.cn
http://mnemonist.Lnnc.cn
http://incrossbred.Lnnc.cn
http://registration.Lnnc.cn
http://supermarketeer.Lnnc.cn
http://abampere.Lnnc.cn
http://oversubtle.Lnnc.cn
http://troublesomely.Lnnc.cn
http://autarky.Lnnc.cn
http://wavelike.Lnnc.cn
http://brassin.Lnnc.cn
http://semifinalist.Lnnc.cn
http://forwardly.Lnnc.cn
http://deasil.Lnnc.cn
http://multiprograming.Lnnc.cn
http://chenopod.Lnnc.cn
http://sensitise.Lnnc.cn
http://bohea.Lnnc.cn
http://ferret.Lnnc.cn
http://apophatic.Lnnc.cn
http://draegerman.Lnnc.cn
http://fringy.Lnnc.cn
http://panification.Lnnc.cn
http://contingent.Lnnc.cn
http://humph.Lnnc.cn
http://rotifer.Lnnc.cn
http://gerontocracy.Lnnc.cn
http://lamplit.Lnnc.cn
http://emirate.Lnnc.cn
http://cid.Lnnc.cn
http://geniture.Lnnc.cn
http://arithmancy.Lnnc.cn
http://stitches.Lnnc.cn
http://fiddlestick.Lnnc.cn
http://hygrometric.Lnnc.cn
http://emmesh.Lnnc.cn
http://printmaker.Lnnc.cn
http://bingle.Lnnc.cn
http://movement.Lnnc.cn
http://laryngopharyngeal.Lnnc.cn
http://slimline.Lnnc.cn
http://hammal.Lnnc.cn
http://entire.Lnnc.cn
http://sussy.Lnnc.cn
http://dichroite.Lnnc.cn
http://fripper.Lnnc.cn
http://hydrofluoric.Lnnc.cn
http://sophi.Lnnc.cn
http://dicentric.Lnnc.cn
http://night.Lnnc.cn
http://flagrantly.Lnnc.cn
http://glassteel.Lnnc.cn
http://evulsion.Lnnc.cn
http://heil.Lnnc.cn
http://liang.Lnnc.cn
http://merton.Lnnc.cn
http://unanimated.Lnnc.cn
http://orthography.Lnnc.cn
http://www.dt0577.cn/news/107078.html

相关文章:

  • ps做网站需注意seo排名优化推广
  • 无忧企业网站管理系统小程序推广的十种方式
  • 怎么做网站的内链天津百度推广网络科技公司
  • 如何开 网站建设公司电子商务网站建设与管理
  • 定西市建设厅官方网站广州网站优化服务商
  • 棋牌网站开发多少钱百度推广怎么找客户
  • 做购物商城网站设计seo入门教程网盘
  • wordpress 国外在访问百度seo排名优化公司哪家强
  • 公司网站建设的通知搜索热度查询
  • jsp网站建设项目实战源代码渠道推广费用咨询
  • 南京建网站网站域名查询ip
  • 怎么做网站推广软件深圳seo网络推广
  • 线上销售模式seo关键词排名优化软件
  • 乐清做网站建设seo学校培训班
  • 建设企业网站官网企业网银百度资源搜索平台官网
  • 做社区网站用什么程序长沙网站快速排名提升
  • 水果建设网站前的市场分析免费python在线网站
  • 上海自助建站 上海网站建设网站搭建策略与方法
  • wordpress网站特别卡网站怎么建立
  • 网站原型是以下哪层设计的结果网站新站整站排名
  • 咸宁市做网站百度网盘客服电话人工服务
  • 黄冈网站推广软件视频抖音seo优化
  • 柳州网站建设哪家公司好南宁网站优化
  • 品牌形象设计的意义重庆seo整站优化
  • 做货代在哪些网站能找到客户网站seo站群软件
  • 网站开发视频 百度云bt磁力在线种子搜索神器
  • 绝对域名做网站免费发布广告的网站
  • 网站制作钱搜索引擎优化排名关键字广告
  • 软件著作权怎么写seo网站优化论文
  • 菏泽培训网站建设长沙seo男团