AtCoder Regular Contest 071
2017-04-10 08:05
549 查看
C - 怪文書 / Dubious Document
题意:定义一种无序的子序列:在原串中随意地取字符并随意打乱顺序。求多个字符串的最长公共无序子序列。#include<cstdio> #include<algorithm> #define MN 1000001 using namespace std; const int MOD=1e9+7; int n,f[MN],m; inline void M(int &x){while(x>=MOD)x-=MOD;} int main(){ int i,j; scanf("%d",&n);f =n;m=n-1; for (i=n-1;i;i--) f[i]=1LL*(n-1)*(n-1)%MOD,M(f[i]+=f[i+1]),M(f[i]+=m),M(m+=(i+2>n?1:f[i+2])-1); printf("%d\n",f[1]); }
View Code
这几乎是我打过码量最少的比赛。
相关文章推荐
- AtCoder Regular Contest 071 F - Infinite Sequence 动态规划
- AtCoder Regular Contest 071 F
- AtCoder Regular Contest 086
- AtCoder Regular Contest 089
- Atcoder Regular Contest 089D Checker
- AtCoder Regular Contest 088 D - People on a Line(DFS+图论)
- AtCoder Regular Contest 076 E - Connected? 乱搞
- AtCoder Regular Contest D - Remainder Reminder 取余问题
- AtCoder Regular Contest 091 E - LISDL
- 思维定势--AtCoder Regular Contest 092 D - Two Sequences
- AtCoder Regular Contest 092 C - 2D Plane 2N Points 贪心 匈牙利算法模板
- 【杂题】[AtCoder Regular Contest 092 D] Two Sequences
- AtCoder Regular Contest 093 D - Grid Components
- 【容斥原理】(AtCoder Regular Contest 093 F) Dark Horse
- AtCoder Regular Contest 074F - Lotus Leaves
- AtCoder Regular Contest 099 C~E
- AtCoder Regular Contest 079 D - Decrease (Contestant ver.)
- Atcoder AtCoder Regular Contest 079 E - Decrease (Judge ver.)
- AtCoder Regular Contest 080 E - Young Maids
- AtCoder Regular Contest 080 [CDEF]