跳至内容
CVBB ACM Team
用户工具
注册
登录
站点工具
搜索
工具
显示页面
修订记录
Copy this page
导出 PDF
反向链接
最近更改
媒体管理器
网站地图
注册
登录
>
最近更改
媒体管理器
网站地图
您在这里:
front_page
»
2020-2021
»
teams
»
manespace
»
cf_round_641_div_2
2020-2021:teams:manespace:cf_round_641_div_2
本页面只读。您可以查看源文件,但不能更改它。如果您觉得这是系统错误,请联系管理员。
===== B ===== * 题意:给你一串数$s$<html><sub></html>$1$<html></sub></html>,$s$<html><sub></html>$2$<html></sub></html>,$s$<html><sub></html>$3$<html></sub></html>,$\ldots$,$s$<html><sub></html>$n$<html></sub></html>. 如果满足下标$i$<html><sub></html>$j$<html></sub></html>,$i$<html><sub></html>$j+1$<html></sub></html>满足$i$<html><sub></html>$j$<html></sub></html><$i$<html><sub></html>$j+1$<html></sub></html>并且有$s$<html><sub></html>$i$<html><sub></html>$j$<html></sub></html><html></sub></html> <$s$<html><sub></html>$i$<html><sub></html>$j+1$<html></sub></html><html></sub></html> .则称这样的安排是美的,题目要你找出一串序列中最长的,具有美感的数列长度。 * 代码:<code cpp> # include <bits/stdc++.h> using namespace std; void solve() { int n; cin >> n; vector <int> a(n + 1), dp(n + 1); for (int i = 1; i <= n; i++) { cin >> a[i]; } int answer = 0; for (int i = 1; i <= n; i++) { int mx = 0; for (int j = 1; j * j <= i; j++) { if (i % j == 0) { if (a[j] < a[i]) mx = max(mx, dp[j]); if (a[i / j] < a[i]) mx = max(mx, dp[i / j]); } } dp[i] = mx + 1; answer = max(answer, dp[i]); } cout << answer << endl; } int main() { int tt = 1; cin >> tt; while (tt--) solve(); } </code>
2020-2021/teams/manespace/cf_round_641_div_2.txt
· 最后更改: 2020/05/15 18:04 由
quantumbolt
页面工具
显示页面
修订记录
反向链接
Copy this page
导出 PDF
回到顶部