题意: 给你 n 长全排列的一种情况,将其分为 k 份,取每份中的最大值相加,输出和的最大值和有多少种分法等于最大值. 思路: 取前 k 大值,储存下标,每两个 k 大值间有 vi+1 - vi 种分法,相乘即可. #include <bits/stdc++.h> using namespace std; typedef long long ll; const ll mod=998244353; int main() { int n,k;cin>>n>>k; int p…
CF640 div4 草 迟到半个月的补题 真正的懒狗 再懒就无了 D. Alice, Bob and Candies 题意:n个数字,奇数时间从左侧删数字,偶数时间从右侧删数字,每次删的数字之和必须大于上次的.问最多删多少次和左边删除数字和与右边删除数字和. 题解:很简单的模拟题,初始情况特判即可,不知道当时为什么没做出来 #include<iostream> using namespace std; int can[1005]; int main() { int t; cin >&g…
The set [1,2,3,…,n] contains a total of n! unique permutations. By listing and labeling all of the permutations in order,We get the following sequence (ie, for n = 3): "123" "132" "213" "231" "312" "3…
题目来源 https://leetcode.com/problems/next-permutation/ Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possible, it must rearrange it as the lowest possible…