Files
python/TangDou/LanQiaoBei/LanQiaoBeiWhitePaper/6_ThreeNumberCount.cpp

15 lines
393 B
C++
Raw Normal View History

2025-08-30 18:35:01 +08:00
#include <bits/stdc++.h>
using namespace std;
int n, cnt;
int main() {
cin >> n;
for (int i = 1; i <= n; i++)//首位不能是0
for (int j = 0; j <= n; j++)//二位可以是0
for (int k = 1; k <= n; k += 2) //三位必须是奇数,1,3,5,7,...
if (k != i && k != j && i != j) cnt++;
cout << cnt << endl;
return 0;
}