Ural 1011 Conductors

http://acm.timus.ru/problem.aspx?space=1&num=1011

本来就是个枚举的题目,但是俄罗斯人的数据果然很刁....

如果先把P,Q转化为小数就会精度不够而在Test14出现WA...= =b

#include<iostream>
using namespace std;
int main()
{
	int x;
	double p,q,peo1,peo2;
	while(cin>>p>>q)
	{
		x=100;
		while(1)
		{
			peo1=x/p-(1e-7);
			peo2=x/q;
			if(int(peo2+1)<=int(peo1))
			{
				cout<<int(peo2+1)<<endl;
				break;
			}
			x+=100;
		}
	}
	return 0;
}
posted @ 2011-03-15 18:44  watana  阅读(144)  评论(0编辑  收藏  举报