标签:using include efi clu unsigned ide logs typedef main
传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=3613
【题解】
其实挺显然。。就是最大逆序对差/2
# include <stdio.h> # include <string.h> # include <iostream> # include <algorithm> // # include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef unsigned long long ull; const int M = 5e6 + 10; # define RG register # define ST static int n, SA, SB, SC, SD; int a[M], mod; inline int F(int x) { ll ret = 1ll * SA * x % mod * x % mod * x % mod + 1ll * SB * x % mod * x % mod + 1ll * SC * x % mod + SD; return int(ret % mod); } int main() { cin >> n >> SA >> SB >> SC >> SD >> a[1] >> mod; for (int i=2; i<=n; ++i) { a[i] = F(a[i-1]) + F(a[i-2]); if(a[i] >= mod) a[i] -= mod; } int mx = -1, ans = 0; for (int i=1; i<=n; ++i) { if(mx >= a[i]) ans = max(ans, (mx-a[i]+1)>>1); mx = max(mx, a[i]); } cout << ans << endl; return 0; }
标签:using include efi clu unsigned ide logs typedef main
原文地址:http://www.cnblogs.com/galaxies/p/bzoj3613.html