排队领水 C++
#include <iostream> #include <cmath> #include <algorithm> #include <vector> using namespace std; int main(){ int n, a, b, cnt = 0; cin >> n >> a >> b; for(int i = 1; i <= n; ++i){ if(i > a && i >= n - b) ++cnt; } cout << cnt; return 0; }
#include <iostream> #include <cmath> #include <algorithm> #include <vector> using namespace std; int main(){ int n, a, b, cnt = 0; cin >> n >> a >> b; for(int i = 1; i <= n; ++i){ if(i > a && i >= n - b) ++cnt; } cout << cnt; return 0; }
相关推荐