0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

AtCodeログ:0134 - ABC 221 A

Posted at

問題

回答

回答1 (AC)

地震のマグニチュードが $X$ 大きいとき、地震のエネルギーの大きさは $32^X$ 倍となるので、$32^{A-B}$ を求めれば良いでしょう。条件より $A-B \le 6$ なので、出力は int 型でおさまります。コードは以下のようになりました。

abc221a-1.cpp
# include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b;
  cin >> a >> b;
 
  cout << (int)pow(32,a-b) << endl;
}}

調べたこと

AtCoder の解説公式解説

マグニチュードを $B$ から $A$ まで変化させる方法と、回答1と同じ解法を紹介しています。

リンク

前後の記事

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?