公式
A - Closed interval 解説 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).
The number of integers between \(L\) and \(R\) can be represented as \(R-L+1\).
Therefore, we may receive \(L\) and \(R\) as inputs, and print \(R-L+1\).
L, R = map(int, input().split())
print(R - L + 1)
#include <bits/stdc++.h>
using namespace std;
int main() {
int L, R;
cin >> L >> R;
cout << R - L + 1 << endl;
return 0;
}
投稿日時:
最終更新: