[]
Post Robot
Time Limit: 2000/1000 MS (Java/others) memory limit: 65536/65536 K (Java/Others)
[Problem description] dt is a big fan of digital products. He writes posts about original ical products Almost everyday in his blog.
But there is such few comments of his posts that he feels depressed all the day. as his best friend and an excellent programmer, DT asked you to help make his blog look more popular. he is so warm that you have no idea how to refuse. but you are unwilling to read all of his boring posts word by word. so you decided to write a script to comment below his posts automatically.
After observation, you found words "apple" appear everywhere in his posts. after your counting, you concluded that "Apple", "iPhone", "iPod", "iPad" are the most high-frequency words in his blog. once one of these words were read by your smart script, it will make a comment "Mai! ", And go on reading the post.
In order to make it more funny, you, as a fan of Sony, also want to make some comments about Sony. so you want to add a new rule to the script: make a comment "Sony Dafa is good!" When "Sony" appears. [input] A blog article described above, which contains only printable characters (whose ASCII code is between 32 and 127), Cr (ASCII code 13, '\ R' in C/C ++), LF (ASCII code 10,' \ n' in C/C ++), please process input until EOF. note all characters are
Case Sensitive.
The size of the article does not exceed 8kb. [Output] Output shoshould contains comments generated by your script, one per line. [sample input] Apple bananaipad lemon applepisony233tim Cook is doubi from appleiphoneipadiphone30 is so biiiiiiig microsoftmakes good app. [sample output] Mai! Mai! Mai! Sony Dafa is good! Mai! Mai! Mai! [Analysis] buy, buy, and buy !!! Scan and judge directly. [E] Game
Time Limit: 2000/1000 MS (Java/others) memory limit: 65536/65536 K (Java/Others)
【Problem description] Here is a game for two players. The rule of the game is described below:
● In the beginning of the game, there are a lot of piles of beads.
● Players take turns to play. each turn, player choose a pile I and remove some (at least one) beads from it. then he coshould do nothing or split pile I into two piles with a beads and B beads. (A, B> 0 and A + B equals to the number of beads of pile I after removing)
● If after a player's turn, there is no beads left, the player is the winner.
Suppose that the two players are all very clever and they will use optimal game strategies. your job is to tell whether the player who plays first can win the game. [input] There are multiple test cases. please process till EOF.
For each test case, the first line contains a postive integer n (n <105) means there are n piles of beads. the next line contains N postive integer, the I-th postive integer AI (AI <231) means there are ai beads in the I-th pile. [Output] for each test case, if the first player can win the game, ouput "win" and if he can't, ouput "lose" [sample input] 1121 131 2 3 [sample output] winloselose [question] Game: There are n stacks at the beginning, and each person takes turns to fetch the process. You can select a stack to fetch any one at a time, and then divide the remaining parts into any number of two stacks. The last person who has finished everything wins. [Analysis] Mom !!! I never heard of the NIM game before the competition !!! Sure enough, the question is too little t_t, things do not know much about t_t // when others brush the brush, I don't know what's going on ...... crying dizzy in the toilet Ah below is a summary of two game theory knowledge posts: http://blog.csdn.net/u012860063/article/details/21816635http://blog.csdn.net/chao1983210400/article/details/10284693# [f] dice
Time Limit: 2000/1000 MS (Java/others) memory limit: 65536/65536 K (Java/Others)
【Problem description] There are 2 special dices on the table. on each face of the dice, a distinct number was written. consider a1.a2, A3, A4, A5, a6 to be numbers written on top face, bottom face, left face, right face, front face and back face of dice. similarly, consider b1.b2, B3, B4, B5, B6 to be numbers on specific faces of dice B. it's guaranteed that all numbers written on dices are integers no smaller than 1 and no more than 6 while AI =aj and Bi =bj for all I =j. specially, sum of numbers on opposite faces may not be 7.
At the beginning, the two dices may face different (which means there exist some I, AI = Bi ). ddy wants to make the two dices look the same from all directions ctions (which means for all I, AI = Bi) only by the following four rotation operations. (Please read the picture for more information) Now ddy wants to calculate the minimal steps that he has to take to achieve his goal. [input] There are multiple test cases. Please process till EOF.
For each case, the first line consists of six integers A1, A2, A3, A4, A5, A6, representing the numbers on Dice.
The second line consists of six integers B1, B2, B3, B4, B5, B6, representing the numbers on Dice B. [Output] for each test case, print a line with a number representing the answer. if there's no way to make two dices exactly the same, output-1. [sample input] 1 2 3 4 5 61 2 3 4 5 61 2 3 5 61 2 5 61 2 5 6 4 31 2 4 5 61 4 2 5 3 6 [sample output] 03 -1 【]
The 2014 acmicpc Asia Regional Xian online