小萌新来报道

这个java代码为什么不对呢,只能通过80%的例子
import java.util.*;
public class Main{
    public static void main(String args[]){
        Scanner sc=new Scanner(System.in);
        long a=sc.nextLong();
        long b=sc.nextLong();
        long p=sc.nextLong();
        long ans=1;
        while(b>0){
            if(b%2==1){ans=ans*a%p;}
            a=a*a%p;
            b>>=1;
        }
        System.out.print(ans);
    }
}


全部评论
坐等大佬讲解,先占位置。
点赞 回复 分享
发布于 2022-02-25 17:26

相关推荐

2025-12-15 12:50
河北工程大学
sta666:我也是这个国际商业化的,三天,一天一面,就通过了,不过我是后端实习生,好好面感觉能过。
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务