Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2014
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <iostream>
  3. #include <math.h>
  4. using namespace std;
  5.  
  6. int main(){
  7.  
  8.     int uno;
  9.     int dos;
  10.     int n;
  11.     while(true){
  12.         cin >> uno;
  13.         cin >> dos;
  14.         if(uno == 0 && dos == 0){
  15.             break;
  16.         }
  17.         cin >> n;
  18.         int powe = pow((uno*uno-4*dos),0.5);
  19.         int a = (uno + powe)/2;
  20.         int b = (uno - powe)/2;
  21.         //cout<< pow((uno*uno-4*dos),0.5)<<" " <<a<< endl;
  22.         int res =  pow(a,n)+pow(b,n);
  23.         cout << res <<endl;
  24.     }
  25.  
  26.  
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement