Problem E
Contemplation! Algebra
Input: Standard Input
Output: Standard Output
Time Limit: 1 Second
Given the value of a+b and ab you will have to find the value of an+bn
The input file
contains several lines of inputs. Each line except the last line contains 3
non-negative integers p, q and n. Here p denotes
the value of a+b and q denotes the value of ab. Input is
terminated by a line containing only two zeroes. This line should not be
processed. Each number in the input file fits in a signed 32-bit
integer. There will be no such input so that you have to find the value of 00.
For each line of input except the last one produce one line of output. This line contains the value of an+bn. You can always assume that an+bn fits in a signed 64-bit integer.
10 16 2 7 12 3 0 0 |
68 91 |
Problem setter: Shahriar Manzoor, Member of Elite
Problemsetters' Panel
Special Thanks: Mohammad Sajjad Hossain