Official
A - Seismic magnitude scales Editorial by en_translator
Since we can assume that it is multiplied by exactly \(32\) when the magnitude is incremented by \(1\), the answer is \(32^{(A-B)}\).
By the constraints, \(A\) and \(B\) are integers and \(B\leq A\), so it can be computed with a for statement. In some language, we can find it with exponentiation or pow function.
Sample code in c++:
#include <bits/stdc++.h>
using namespace std;
int main(void) {
int a, b;
int k = 1;
cin >> a >> b;
for (int i = b; i < a; i++)k *= 32;
cout << k << endl;
return 0;
}
Sample code in c++ (with pow function):
#include <bits/stdc++.h>
using namespace std;
int main(void) {
int a, b;
cin >> a >> b;
cout << (int)pow(32,a-b) << endl;
return 0;
}
Sample code in Python:
a,b= map(int, input().split())
print(32**(a-b))
posted:
last update: