Skip to content

Instantly share code, notes, and snippets.

@whatalnk
Last active November 13, 2016 01:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whatalnk/38c5bad0df8f5216e780717d21d63d3e to your computer and use it in GitHub Desktop.
Save whatalnk/38c5bad0df8f5216e780717d21d63d3e to your computer and use it in GitHub Desktop.
AtCoder ABC #040 A [C++]
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int main() {
int n, x;
cin >> n >> x;
cout << min({x - 1, n - x }) << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment