题解 | #过山车#
过山车
https://ac.nowcoder.com/acm/problem/22237
情况分三种,第一种为满人或无人,第二种情况是少量人,每个人能提供前后两个位置,第三种情况为大量人,除开已经坐了人的位置都可以坐
#include<bits/stdc++.h>
using namespace std;int main(){
long long int n,k;
cin>>n>>k;
if(n==k||k==0) cout<<0<<" "<<0;
else {cout<<1<<" ";
if(3*k<=n) cout<<2*k;
else cout<<n-k;
}
}

查看30道真题和解析