Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main(){
- ios_base::sync_with_stdio(0), cin.tie(0);
- int l = 0, c = 0, n = 0;
- cin >> l >> c >> n;
- int si = 0, pi = 0;
- int ans = 0;
- int val = 0;
- for(int i=0; i<c; i++){
- cin >> si >> pi;
- if(pi<n){
- val = n-pi;
- }else{
- val = pi-n;
- }
- // cout << val << '\n';
- ans = val+si;
- cout << ans << '\n';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement