公式

A - Chocolate Bar Count 解説 by en_translator 印刷ページ


If you are new to learning programming and do not know where to start, please try Problem A “Welcome to AtCoder” from practice contest. There you can find a sample code for each language.
Also, if you are not familiar with problems in programming contests, we recommend you to try some problems in “AtCoder Beginners Selection” (https://atcoder.jp/contests/abs).


Original proposer: admin

What remains after all operations have been done is a chocolate bar with \(30-B\) rows and \(30-R\) columns.
This contains \((30-B) \times (30-R)\) pieces of chocolate.
Therefore, the problem can be answered by receiving \(B\) and \(R\) from the input, calculating this expression, and printing the result.

Sample code (C++):

#include<bits/stdc++.h>

using namespace std;

int main(){
  int B,R;
  cin >> B >> R;
  cout << (30-B)*(30-R) << "\n";
  return 0;
}

投稿日時:
最終更新: