我们考虑在1...n-1中选取三个数不重复的有多少种?答案是(n-1)*(n-2)*(n-3)种。
每三个数组成六种序列,只有一种单增。
#include<iostream>#include<cstdio>using namespace std;int n;int main(){ scanf("%d",&n); printf("%d ",(n-3)*(n-1)*(n-2)/6); return 0;}