static void Main(string[] args) { int Count; int i; int exp, co; Node a = new Node(), b = new Node(); Node result = new Node(); Count = Convert.ToInt32(Console.ReadLine()); for (i = 0; i < Count; i++) { co = Convert.ToInt32(Console.ReadLine()); exp = Convert.ToInt32(Console.ReadLine()); a.Read(co, exp); } Count = Convert.ToInt32(Console.ReadLine()); for (i = 0; i < Count; i++) { co = Convert.ToInt32(Console.ReadLine()); exp = Convert.ToInt32(Console.ReadLine()); b.Read(co, exp); } result = a + b; result.Print(); }
public void Read(int co,int exp) { Last.Next = new Node(); Last = Last.Next; Last.Coefficient = co; Last.Exponent = exp; Last.Next = null; }
public static Node operator +(Node a, Node b) { Node result = new Node(); return result; }
public Node() { Next = null; Last = this; Coefficient = Exponent = 0; }