提交时间:2023-08-09 20:59:23

运行 ID: 81695

#include <bits/stdc++.h> using namespace std; long long solve1(long long n) { return n * (n - 1) / 2; } long long solve2(long long n) { return n * (n- 1) * (n - 2) * (n - 3) / (4 * 3 * 2); } int main() { int t; long long n; cin >> t >> n; if (t == 1) { cout << solve1(n); } if (t == 2) { cout << solve2(n); } if (t == 3) { cout << 1 + solve1(n) + solve2(n); } return 0; }