Welcome   HUNAN NORMAL UNIVERSITY ACM/ICPC Judge Online
Home
FAQs
Problem Set
Practices
Online Contests
Major Exercises
OI Special
Judgement
Submit
Online Status
User Ranklist
Users
Register new
Login
Web Links
Hunan Normal University
College of Information Science and Engineering
复数
Time Limit: 1000ms, Special Time Limit:2500ms, Memory Limit:32768KB
Total submit users: 215, Accepted users: 213
Problem 10489 : No special judgement
Problem description
  我们可以用下列结构描述复数信息

struct complex

{

     int real;

     int im;

};

试写出两个通用函数,分别用来求两复数的和与积。其函数原型分别为:

struct complex cadd(struct complex  creal,struct complex cim);

struct complex cmult(struct complex creal,struct complex cim);

即参数和返回值用结构变量。

Input
  输入数据有若干行。每行上有四个整数,前两个表示一个复数的实部和虚部,后两个表示另一个复数的实部和虚部。

Output
  对于每一组数据,输出两复数的和与积,格式参照样例输出。

Sample Input
1 2 3 4
2 1 4 -1
Sample Output
4+(6i)
-5+(10i)
6+(0i)
9+(2i)
Submit   Clarifications   Judge Status  Problems  Ranklist 

HUNAN NORMAL UNIVERSITY ACM/ICPC Judge Online, Version 2010.5.5.final.
Web visits:2188 today,16258915 total, since 2010-05-07