Files
python/TangDou/Topic/Mobius/莫比乌斯函数.cpp

19 lines
372 B
C++
Raw Normal View History

2025-08-30 18:35:01 +08:00
#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
cin >> n;
for (int i = 1; i <= n; i++) {
printf("F(%d)=", i);
for (int j = 1; j <= n; j++) {
if (i % j == 0) {
if (j > 1) printf("+");
printf("f(%d)", j);
}
}
puts("");
}
return 0;
}