关于pow函数的问题
查看原帖
关于pow函数的问题
1145090
BoubbleSort___楼主2024/3/4 12:32

代码如下:

#include<stdio.h>
int main(){
    int a,b;
    scanf("%d %d",&a,&b);
    
    //long long x=pow(a,b);
    int x = 1;
    for(int i=0;i<b;i++){
        x=(x*a)%1000;
    }
    printf("%03d",x);
    return 0;
}

为什么用pow函数最后两个测试点会错,是精度不对还是其他问题? 望大佬解答!!!

2024/3/4 12:32
加载中...