题库练习 Aroma's Search
← 上一题 下一题 →

A13237 | Aroma's Search

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

[THE SxPLAY & KIVΛ - 漂流](https://soundcloud.com/kivawu/hyouryu)



[KIVΛ & Nikki Simmons - Perspectives](https://soundcloud.com/kivawu/perspectives)



With a new body, our idol Aroma White (or should we call her Kaori Minamiya?) begins to uncover her lost past through the OS space.

The space can be considered a 2D plane, with an infinite number of data nodes, indexed from $0$ , with their coordinates defined as follows:

- The coordinates of the $0$ -th node is $(x_0, y_0)$
- For $i > 0$ , the coordinates of $i$ -th node is $(a_x \cdot x_{i-1} + b_x, a_y \cdot y_{i-1} + b_y)$

Initially Aroma stands at the point $(x_s, y_s)$ . She can stay in OS space for at most $t$ seconds, because after this time she has to warp back to the real world. She doesn't need to return to the entry point $(x_s, y_s)$ to warp home.

While within the OS space, Aroma can do the following actions:

- From the point $(x, y)$ , Aroma can move to one of the following points: $(x-1, y)$ , $(x+1, y)$ , $(x, y-1)$ or $(x, y+1)$ . This action requires $1$ second.
- If there is a data node at where Aroma is staying, she can collect it. We can assume this action costs $0$ seconds. Of course, each data node can be collected at most once.

Aroma wants to collect as many data as possible before warping back. Can you help her in calculating the maximum number of data nodes she could collect within $t$ seconds?

输入格式

The first line contains integers $x_0$ , $y_0$ , $a_x$ , $a_y$ , $b_x$ , $b_y$ ( $1 \leq x_0, y_0 \leq 10^{16}$ , $2 \leq a_x, a_y \leq 100$ , $0 \leq b_x, b_y \leq 10^{16}$ ), which define the coordinates of the data nodes.

The second line contains integers $x_s$ , $y_s$ , $t$ ( $1 \leq x_s, y_s, t \leq 10^{16}$ ) – the initial Aroma's coordinates and the amount of time available.

输出格式

Print a single integer — the maximum number of data nodes Aroma can collect within $t$ seconds.

输入输出样例

输入 #1
1 1 2 3 1 0
2 4 20
输出 #1
3
输入 #2
1 1 2 3 1 0
15 27 26
输出 #2
2
输入 #3
1 1 2 3 1 0
2 2 1
输出 #3
0
C++ 编辑器
输入
输出