关注
import java.util.*; public class Main{ public static class Complex { public int real; public int image; public Complex(int real,int image){ this.real = real; this.image = image;
} public static Complex mul(Complex c1,Complex c2){ int newReal = c1.real * c2.real - c1.image * c2.image; int newImage = c1.real * c2.image + c1.image * c2.real; return new Complex(newReal, newImage);
} public static Complex add(Complex c1, Complex c2){ return new Complex(c1.real+c2.real,c1.image+c2.image);
} public void show(){
System.out.println(real);
System.out.println(image);
}
} public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
Complex[] a = new Complex[5];
Complex[] b = new Complex[5]; for(int i=0;i<5;i++){
a[i] = new Complex(sc.nextInt(),sc.nextInt());
} for(int i=0;i<5;i++){
b[i] = new Complex(sc.nextInt(),sc.nextInt());
} for(int i = 8; i >=0; i--){ getOne(i, a, b).show();
}
} public static Complex getOne(int index, Complex[] a, Complex[] b){
Complex res = new Complex(0,0); for(int k = 0;k <=index ;k++){
Complex aa = (k>=0 && k<=4) ? a[k] : new Complex(0,0);
Complex bb = (index-k>=0 && index-k<=4) ? b[index-k] : new Complex(0,0);
res = Complex.add(res, Complex.mul(aa, bb));
} return res;
}
}
查看原帖
点赞 评论
相关推荐
06-03 03:20
河北农业大学 人力资源专员/助理 点赞 评论 收藏
分享
点赞 评论 收藏
分享
牛客热帖
更多
正在热议
更多
# 考研对你找工作产生了哪些影响? #
14887次浏览 136人参与
# 你的房租占工资的比例是多少? #
29042次浏览 304人参与
# 聊聊这家公司值得去吗 #
255035次浏览 2343人参与
# 找实习你看重大厂光环还是业务方向 #
8592次浏览 77人参与
# 职场捅娄子大赛 #
366898次浏览 3753人参与
# 你最满意的offer薪资是哪家公司? #
26936次浏览 143人参与
# 每人推荐一个小而美的高薪公司 #
74483次浏览 1364人参与
# kpi面有什么特征 #
40413次浏览 327人参与
# 打杂的实习你会去吗? #
111557次浏览 970人参与
# 机械应届生薪资要多少才合适? #
22806次浏览 92人参与
# 你有哪些缓解焦虑的方法? #
8488次浏览 268人参与
# 大家实习每天都在干啥 #
81200次浏览 500人参与
# 来聊聊机械薪资天花板是哪家 #
123846次浏览 739人参与
# 米哈游工作体验 #
15687次浏览 112人参与
# 秋招前后对offer的期望对比 #
290945次浏览 2177人参与
# 为了找工作你投递了多少公司? #
17653次浏览 249人参与
# 机械人的薪资开到多少,才适合去? #
109687次浏览 449人参与
# 机械只有读研才有出路吗? #
20277次浏览 230人参与
# 小米求职进展汇总 #
827439次浏览 5928人参与
# 硬件/芯片公司工作体验 #
76208次浏览 670人参与