跳到正文

李思远

400182

人生若只如初见,

在洛谷打开
资料、奖项与版本

资料

编号
400182
抓取

这家伙长得好养眼啊,所以虽然他懒,但还是想写点什么

Mable862 #include<bits/stdc++.h> using namespace std; int n,first[3][100001]; long long maxn,maxt,maxo,maxi,ans; char s[100001]; int main() { scanf(“%d”,&n); for (int i=1;i<=n;i++) { scanf(” %c”,&s[i]); if(s[i]==‘N’) first[0][i]=first[0][i-1]+1;else first[0][i]=first[0][i-1]; if(s[i]==‘O’) first[1][i]=first[1][i-1]+1;else first[1][i]=first[1][i-1]; if(s[i]==‘I’) first[2][i]=first[2][i-1]+1;else first[2][i]=first[2][i-1]; } for (int i=1;i<=n;i++) { if(s[i]==‘N’) maxi+=first[1][n]-first[1][i]; if(s[i]==‘O’) maxt+=first[0][i](first[2][n]-first[2][i]); if(s[i]==‘I’) maxn+=first[1][i]; maxo=maxo>first[0][i-1](first[2][n]-first[2][i-1])?maxo:first[0][i-1]*(first[2][n]-first[2][i-1]); } ans=max(maxn,maxo); ans=max(ans,maxi); printf(“%lld”,ans+maxt); return 0; }

https://www.luogu.com.cn/paste/1agz1vs7

https://www.luogu.com.cn/blog/lxy0508cpp/you-hu-lian-jie-ji-ge

https://box3.fun/p/bedwars?recommend_by=79810

slay.one

https://www.cnblogs.com/Xing-Ling/p/10929936.html

https://www.luogu.com.cn/paste/iq7oxe94

https://www.luogu.com.cn/paste/xyg3adux

https://delicious-fruit.com/

还没有收录这位用户的文章。