我是靠谱客的博主 紧张秀发,这篇文章主要介绍蓝桥杯 java矩阵翻银币_[蓝桥杯][2014年第五届真题]矩阵翻硬币 (Java代码),现在分享给大家,希望可以做个参考。

解题思路:

注意事项:

参考代码:

import java.math.BigInteger;

import java.util.Scanner;

public class Main{

public static void main(String[] args) {

Scanner input=new Scanner(System.in);

BigInteger a=input.nextBigInteger(),b=input.nextBigInteger();

if(a.compareTo(new BigInteger("1"))==0&&b.compareTo(new BigInteger("1"))==0){

System.out.println(1);

return;

}

BigInteger c=a.mod(new BigInteger("2"));

BigInteger d=b.mod(new BigInteger("2"));

if(c.compareTo(d)==0){

System.out.println(a.multiply(b).subtract(new BigInteger("1")));

}else {

System.out.println(1);

}

return;

}

}

最后

以上就是紧张秀发最近收集整理的关于蓝桥杯 java矩阵翻银币_[蓝桥杯][2014年第五届真题]矩阵翻硬币 (Java代码)的全部内容,更多相关蓝桥杯内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(61)

评论列表共有 0 条评论

立即
投稿
返回
顶部