标签:har size 找规律 连续 include new i+1 using com
#include<bits/stdc++.h> using namespace std; #define ll long long const int maxn=6e5+10; int num[maxn]; vector<int>ve; int main() { int k=8; while(k--) { ve.clear(); cout<<k<<" "; for(int i=0; i<maxn; i++) num[i]=i; do { for(int i=1; i<=k; i++) ve.push_back(num[i]); } while(next_permutation(num+1,num+k+1)); int ans=0; for(int i=0; i<ve.size(); i++) { for(int j=i; j<ve.size(); j++) { if(j-i+1!=k)continue; ll cal=0; for(int l=i; l<=j; l++) cal+=ve[l]; if(cal==(k+1)*k/2) ans++; } } cout<<ans<<endl; } return 0; }
codeforces#1090 D. New Year and the Permutation Concatenation(打表找规律)
标签:har size 找规律 连续 include new i+1 using com
原文地址:https://www.cnblogs.com/carcar/p/10205692.html