#include
using namespace std;
long int f[51], mod = 2147483648, m;
int n, i, flag = 0;
int main() {
f[1] = 1;
f[2] = 1;
cin >> n;
for (i = 3; i <= n; i++) f[i] = f[i - 1] + f[i - 2];
m = f[n] % mod;
cout << m << "=";
i = 2;
while (m > 1) {
if (m % i == 0) {
if (flag == 0) {
flag = 1;
cout << i;
m = m / i;
} else
cout << "*" << i, m = m / i;
} else
i++;
}
return 0;
}
那有错啊!!!
共 3 条回复
#include using namespace std; long int f[51], mod = 2147483648, m; int n, i, flag = 0; int main() { f[1] = 1; f[2] = 1; cin >> n; for (i = 3; i <= n; i++) f[i] = f[i - 1] + f[i - 2]; m = f[n] % mod; cout << m << "="; i = 2; while (m > 1) { if (m % i == 0) { if (flag == 0) { flag = 1; cout << i; m = m / i; } else cout << "*" << i, m = m / i; } else i++; } return 0; } 那有错啊!!!
我也