here is my code:
include <bits/stdc++.h>
using namespace std;
int main() { double a,b; double sum=0;
cin >> a>>b;
sum = pow(a,b)-pow(b,a); cout << sum<< endl; return 0; }
why it is showing wrong answer on test 5 no matter whay i do.
question: You are given natural numbers a and b. Find ab-ba.
Input
Input contains numbers a and b (1≤a,b≤100).
Output
Write answer to output.
Sample Input
2 3
Sample Output
-1
Consider the input
99 100
. Note that bothpow(99, 100)
andpow(100, 99)
will overflow the limits of int or even long long int in C++. So you could solve this problem using big integers. For example, in python you can simply submit: