以下の内容はhttps://blog.hamayanhamayan.com/entry/2019/04/13/231648より取得しました。


Buttons [AtCoder Beginner Contest 124 A]

https://atcoder.jp/contests/abc124/tasks/abc124_a

解説

https://atcoder.jp/contests/abc124/submissions/4962028

場合分けをして解くことにする。
A=Bなら、どっちも取るのが最適。
そうでないなら、大きい方を2回取るのが最適。

int A, B;
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> A >> B;
 
	int ans = 0;
	if (A == B) ans = A + B;
	else ans = 2 * max(A, B) - 1;
	cout << ans << endl;
}



以上の内容はhttps://blog.hamayanhamayan.com/entry/2019/04/13/231648より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14