水题,模拟题,但仍需细心,多考虑

//http://codeforces.com/contest/1065/problem/B
#include <iostream> #include <cmath> using namespace std; int main() { long long n,m,num,s,a,b,c,minIS,maxIS; cin>>n>>m; if(n<2*m) { minIS=0; } else { minIS=n-2*m; } if(m==2) { maxIS=n-3; } else if(m==0) { maxIS=n; } else { maxIS=n-(1+(sqrt(1+8*m)))/2; } cout<<minIS<<" "<<maxIS<<endl; return 0; }

猜你喜欢

转载自www.cnblogs.com/LandingGuy/p/9783699.html