⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pku2857.cpp

📁 这是ACM 方面的资料 是PKU的 北京大学的出来的
💻 CPP
字号:
#include <stdio.h>

int main()
{
	double H, V, h, v, tH, tV;
	double nh, nv, mh, mv;
	int cnt;
	int T;
	int kase = 1;
	while (EOF != scanf("%lf %lf %lf %lf", &H, &V, &h, &v) && (H + V + h + v))
	{
		scanf("%d", &T);
		printf("Case %d:\n", kase++);
		while (T--)
		{
			tH = H;
			tV = V;
			scanf("%lf %lf", &nh, &nv);
			cnt = 0;
			mh = 0;
			mv = 0;
			while ((mh - nh) * (mv - nv) > 0)
			{
//				printf("%e\n", (mh - nh) * (mv - nv));
//				printf("nh = %lf nv = %lf\n", nh, nv);
				cnt++;
				if (nh < mh || nv < mv)
				{
					tH = mh;
					tV = mv;
				}
				else
				{
					tH -= mh;
					tV -= mv;
					nh -= mh;
					nv -= mv;
				}
				mh = tH * h;
				mv = tV * v;
			}
			printf("%s\n", cnt & 1 ? "black" : "white");
		}
	}
	return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -