1. 程式人生 > >ACM 數論 UVALive 6170 Esspe-Peasee 解二元一次方程 擴張歐幾里得演算法

ACM 數論 UVALive 6170 Esspe-Peasee 解二元一次方程 擴張歐幾里得演算法

Download as PDF

Esspe-Peasee is an ancient game played by children throughout the land of Acmania. The rules are simple:

A player simply quibs the yorba at the kwonk. If the yorba hurms the kwonk the player gets a foom. If the yorba hurfs the kwonk the player gets a foob.

The objective is to get a twob with as few quibs as possible.


Every group of children has its own opinion regarding the value of a foom, the value of a foob, and the value of a twob. However, everyone agrees that a foob is worth more than a foom, and that a twob is worth more than a foob. You may assume that a foom and a foob can each be represented by a 32 bit integer, and a twob can be represented by a 64 bit integer.