神奇现象?
查看原帖
神奇现象?
804115
yzm0325楼主2023/7/19 15:03

我的代码:

#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
    cin >> n;
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= i; j++)
            printf("%d ^ %d = %d ", i, j, pow(i, j));
        cout << "\n";
    }
    return 0;
}

输出是:

1 ^ 1 = 0 
2 ^ 1 = 0 2 ^ 2 = 0 
3 ^ 1 = 150 3 ^ 2 = 44 3 ^ 3 = 194 

就很离谱,但是我单独测试 3^1 时就正确了。

求大佬解答!

2023/7/19 15:03
加载中...