Train(求从前开始数的第i个数是从n开始数的第几个数)
问题 A: Train
时间限制: 1 Sec 内存限制: 128 MB
题目描述
There is an N-car train.
You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."
Constraints
1≤N≤100
1≤i≤N
输入
Input is given from Standard Input in the following format:
N i
输出
Print the answer.
样例输入
复制样例数据
4 2
样例输出
3
提示
The second car from the front of a 4-car train is the third car from the back.
/**/
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <stack>
#include <queue>
typedef long long LL;
using namespace std;
int main()
{
//freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
int n, i;
scanf("%d %d", &n, &i);
printf("%d\n", n - i + 1);
return 0;
}
/**/