2018蓝桥杯省赛---java---B---3(复数幂)
生活随笔
收集整理的這篇文章主要介紹了
2018蓝桥杯省赛---java---B---3(复数幂)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
題目描述
思路分析
代碼實現
package com.atguigu.TEST;import java.io.File; import java.io.FileNotFoundException; import java.io.PrintStream; import java.math.BigInteger;class Main{public static void main(String[] args) {BigInteger two = BigInteger.valueOf(2);BigInteger three = BigInteger.valueOf(3);BigInteger zero = BigInteger.valueOf(0);BigInteger a = BigInteger.valueOf(2);BigInteger b = BigInteger.valueOf(3);BigInteger aa=null;BigInteger bb=null;for (int i = 0; i < 123455; i++) {aa=a.multiply(two).subtract(b.multiply(three));//a*2-b*3bb=a.multiply(three).add(b.multiply(two));//a*3+b*2a=aa;b=bb;}try {System.setOut(new PrintStream(new File("D:\\pwd.txt")));} catch (FileNotFoundException e) {e.printStackTrace();}System.out.println(aa+(bb.compareTo(zero)<0?"-":"+")+bb+"i");}}總結
以上是生活随笔為你收集整理的2018蓝桥杯省赛---java---B---3(复数幂)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 办公电脑配置的需求有哪些?
- 下一篇: 办公电脑最佳配置?