当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

6456:Distance Between Sweethearts

题目描述
Recently, my little sweetheart started to ignore me again.
I was not sure this time if it's thanks to the agony of a long-distance relationship.
So I flew to her city.
Nothing changed.
Alright, I bet you pray to God that even though you ignore me I still love you.
But this seems like strange reasoning to me, as relationships are hard enough even without a $16000$-mile gap between you and me.

As Stephanie Coontz put in her book Marriage, a History:

People have always loved a love story. But for most of the past our ancestors did not try to live in one.


She argues that the historical shift in emphasis to romantic love is related to the decline of religion, the precariousness of work situations, and the tendency of people to move about geographically rather than remaining in one place.
However, an inevitable tension here exists because we are also living in a time which emphasises individuality, autonomy and reaching our personal goals.
This means that old rules around rigid gender roles in relationships no longer apply.
As sociologists put it:

Love is becoming a blank that lovers must fill in themselves.


Back to my personal question, I quantize the individualities, autonomies and personal goals for my little sweetheart and myself to non-negative integers, denoted by $I_{girl}, A_{girl}, G_{girl}$ and $I_{boy}, A_{boy}, G_{boy}$ respectively.
A brilliant mathematical model that will save my love gives the following formula to measure the distance between the heart of my little sweetheart and mine:

$$distance(boy, girl) = \max\{|I_{boy} - I_{girl}|, |A_{boy} - A_{girl}|, |G_{boy} - G_{girl}|\} \oplus I_{boy} \oplus A_{boy} \oplus G_{boy} \oplus I_{girl} \oplus A_{girl} \oplus G_{girl},$$

where $\max\{S\}$, $|x|$ and $\oplus$ correspond to the maximum value in $S$, the absolute value of $x$ and the bitwise exclusive-OR operator respectively.

Sadly, it is hard to get these precise values and what I have now are their upper bounds.
That is to say, they satisfy the following restrictions:

$$0 \le I_{girl} \le UI_{girl}, 0 \le A_{girl} \le UA_{girl}, 0 \le G_{girl} \le UG_{girl}$$

and

$$0 \le I_{boy} \le UI_{boy}, 0 \le A_{boy} \le UA_{boy}, 0 \le G_{boy} \le UG_{boy}.$$

Any value of them can be all integers in its restriction with the same probability.
Now I need your help to calculate the expected distance between the hearts of the still amorous couple that we are.
Please feedback the product between $(1 + UI_{boy}) (1 + UA_{boy}) (1 + UG_{boy}) (1 + UI_{girl}) (1 + UA_{girl}) (1 + UG_{girl})$ and the expected distance (which must be an integer).
输入解释
The input contains several test cases, and the first line contains a positive integer $T$ indicating the number of test cases which is up to $10$.

For each test case, the only line contains six integers $UI_{boy}, UA_{boy}, UG_{boy}$ and $UI_{girl}, UA_{girl}, UG_{girl}$, each of which is a non-negative integer up to $2000$.
输出解释
For each test case, output a line containing "Case #x: y"(without quotes), where x is the test case number starting from $1$, and y is the answer to this test case.

We guarantee that all answers are no more than $(2^{64} - 1)$.
输入样例
3
3 1 2 4 3 3
1 2 1 2 1 3
3 2 5 4 3 5
输出样例
Case #1: 3880
Case #2: 369
Case #3: 24728
提示
‘Marriage, a History’ is the one book you need to understand not only the nuances of modern marriage but also gay marriage, “living together” and divorce. Stephanie Coontz shatters dozens of myths about the past and future of married life and shows us why marriage, though more fragile today, can be more rewarding than ever before.
– from the inside of the book jacket

来自杭电HDUOJ的附加信息
Recommend chendu

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-6456

最后修改于 2020-10-25T23:31:31+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
12000/8000MS(Java/Others) 262144/262144K(Java/Others)