传送门

思路

,则可以通过化简取取对数,得到。所以本题同理,这样化简后,就转成了,以结尾的子序列个数有多少,所以可以枚举起点和终点。
时间复杂度:

Tags

  • DP
  • 数学

参考代码

//#include <bits/stdc++.h>
#include <bitset>
#include <iomanip>
#include <iostream>
#include <list>
#include <set>
#include <sstream>
#include <stack>
#include <string>
//#include <array>
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iterator>
#include <map>
#include <memory>
#include <queue>
#include <vector>
using namespace std;
#define FAST_IO ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef unsigned int UINT;
typedef unsigned long long ull;
typedef pair<int, int> pdi;
typedef pair<ll, int> pli;

int const maxn = 1000 + 10;
const int INF = 0x3f3f3f3f;
const ll INFL = 0x3f3f3f3f3f3f3f3f;
inline int lc(int x) { return x << 1; }
inline int rc(int x) { return x << 1 | 1; }

int dp[maxn];
int a[maxn];
int const MOD = 1e9 + 7;
int main(void) {
    FAST_IO;

    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    for (int i = 1; i <= n; i++) {
        dp[i] = 1;
        for (int j = 1; j < i; j++) {
            if (log10(a[j]) * i < log10(a[i]) * j) {
                dp[i] = (0LL + dp[i] + dp[j]) % MOD;
            }
        }
    }
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        ans = ans + dp[i];
        ans %= MOD;
    }
    cout << ans << endl;

    return 0;
}