• 2024-04-23E. Klever Permutation
    链接:https://codeforces.com/problemset/problem/1927/E思路:观察,可知每隔k个数据就是+1/-1,且间隔而分,思路如下:然后按顺序打表就行代码:#include<iostream>#include<vector>#include<algorithm>#include<math.h>#include<sstream>#include<string>#includ
  • 2024-02-10E. Klever Permutation
    E.KleverPermutationYouaregiventwointegers$n$and$k$($k\len$),where$k$iseven.Apermutationoflength$n$isanarrayconsistingof$n$distinctintegersfrom$1$to$n$inanyorder.Forexample,$[2,3,1,5,4]$isapermutation,but$[1,2,
  • 2024-02-09E. Klever Permutation
    题解假设a1a2a3...ak ak+1ak+2...an是符合要求的数组,那么我们可以推断出:a(k+1)=a(1)+1;a(k+2)=a(2)-1;...a(2k+1)=a(k+1)+1;...因此我们知晓奇数位的数要比较小,偶数的位置要比较大;又题目说明一定有解,所以我们假定a1=1,a2=n再递推出其余各项。Code#include<b