#P3996. 失败的竞猜游戏
失败的竞猜游戏
Description
The game rules are as follows: The player gives three integers , , , which define a linear recurrence: It defines an infinite sequence { , , , ... }. The game system randomly generates a number . If can be represented as the sum of several distinct terms from this sequence (excluding ), the player wins; otherwise, the player loses. Now Daning has forced the operator to hand over a batch of recent game testdata, but he is too lazy to compute them one by one. Please help determine how many times the player won in the testdata.
Input Format
The first line contains a positive integer , the number of games played. Each of the next lines contains four integers, describing one game: , , , .
Output Format
Output one line with , the number of times the player won among the games.
7
3 1 5 16
10 1 0 5
2 1 0 3
2 1 0 10
3 1 5 59
1 2 0 998
0 1 0 0
4
Hint
Sample explanation: In games the player loses; in games the player wins.
| Test point ID | Constraints | Special properties |
|---|---|---|
| , | ||
| , | ||
| , | ||
| , | ||
| , | None |
For all testdata, , , , .
In fact, the player's win rate in this game is negligible.
Translated by ChatGPT 5
京公网安备 11011102002149号