# HDU 2293 name PK

Source: Internet
Author: User

Name PK

Time Limit: 2000/1000 MS (Java/others) memory limit: 32768/32768 K (Java/Others)
Total submission (s): 148 accepted submission (s): 75

Problem descriptionname PK is a funny game on the Internet. The game will calculate character's property based on its name.
Now we're re simulating a simple name PK game. Each character has 3 parameters: HP, STR and SPD (HP for health point, STR for strength and SPD for attacking speed ).

For a name string of length N, CI is ASCII code (decimal) of the I-th char.

PK rule:
1. Timer begins to increase from 1. When it is a multiple of (20-spd), the corresponding character a has that SPD attack once, the opposite lose STR (A's) HP.

2. When any side has a HP ≤ 0, the PK is over.

Inputthe input consists of several test cases. the first line of input consists of an integer T, indicating the number of test cases. each test case is on a separate line, and it consists two strings separated by a whitespace, indicating the name of the characters.
Technical Specification

1. Names contain only English letters.
2. The length of each character's name is more than 1 and no more than 20.
3. T ≤ 1000.

Outputfor each test case, output a line consisting of the result of the first character: "win", "lose" or "Tie ".

Sample Input
`3Sylvia xayIvan StacyBoyd Greg`

Sample output
`losewinlose`
` `
`The key to this question is the last step. You cannot simulate a timer attack. Otherwise, the attack times out. Calculate the time when a was killed by the attack, and compare it with the time when B was killed by the attack.`
` # Include <iostream> # include <cmath> # include <cstring> # include <map> # include <algorithm> using namespace STD; int main () {int test; int AHP, BHP, astr, BSTR, aspd, bspd; string a, B; int Alen, blen; CIN> test; while (test --) {AHP = 0, BHP = 0, astr = 1, BSTR = 1, aspd = 0, bspd = 0; CIN> A> B; Alen =. length (); blen = B. length (); For (INT I = 0; I <Alen; I ++) {AHP = (AHP + (83-A [I]) * (83-a [I]) % 97; Astr = (astr * A [I]) % 79; For (Int J = I + 1; j <Alen; j ++) {aspd = (aspd + A [I] * A [J]) % 11 ;}} for (INT I = 0; I <blen; I ++) {BHP = (BHP + (83-B [I]) * (83-b [I]) % 97; BSTR = (BSTR * B [I]) % 79; for (Int J = I + 1; j <blen; j ++) {bspd = (bspd + B [I] * B [J]) % 11 ;}} AHP = 300-AHP; BHP = 300-BHP; astr + = 22; BSTR + = 22; int aw = BHP/astr; // a win, B needs to be attacked several times by. if (BHP % astr! = 0) // whether B is killed in the last attack of A. If B is not killed, call again. Aw ++; int BW = AHP/BSTR; If (AHP % BSTR! = 0) BW ++; Aw * = (20-aspd); BW * = (20-bspd); If (AW = BW) {cout <"Tie" <Endl;} else if (AW <BW) {cout <"win" <Endl ;} else {cout <"lose" <Endl ;}}}`
Related Keywords:

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

## A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

• #### Sales Support

1 on 1 presale consultation

• #### After-Sales Support

24/7 Technical Support 6 Free Tickets per Quarter Faster Response

• Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.