Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <iostream>
- #include <math.h>
- using namespace std;
- int main(){
- int uno;
- int dos;
- int n;
- while(true){
- cin >> uno;
- cin >> dos;
- if(uno == 0 && dos == 0){
- break;
- }
- cin >> n;
- int powe = pow((uno*uno-4*dos),0.5);
- int a = (uno + powe)/2;
- int b = (uno - powe)/2;
- //cout<< pow((uno*uno-4*dos),0.5)<<" " <<a<< endl;
- int res = pow(a,n)+pow(b,n);
- cout << res <<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement