码迷,mamicode.com
首页 > Web开发 > 详细

poj 3911 Internet Service Providers 解一元二次方程

时间:2015-04-03 01:37:30      阅读:164      评论:0      收藏:0      [点我收藏+]

标签:poj   算法   

少有人做的水题,直接贴代码。

//poj 3911
//sep9
#include <iostream>
using namespace std;
typedef long long ll; 

int main()
{
	ll n,c;
	while(scanf("%lld%lld",&n,&c)==2){
		if(n==0){
			printf("0\n");
			continue;
		}	
		ll x=c/(2*n);
		ll y=x+1;		
		printf("%lld\n",x*(c-n*x)>=y*(c-n*y)?x:y);
	}
	return 0;	
} 


poj 3911 Internet Service Providers 解一元二次方程

标签:poj   算法   

原文地址:http://blog.csdn.net/sepnine/article/details/44842161

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!