impossible

H - Lift Hopping UVA - 10801

▼魔方 西西 提交于 2020-02-22 06:42:55
1.题目 H - Lift Hopping UVA - 10801 A skyscraper has no more than 100 floors, numbered from 0 to 99. It has n (1 ≤ n ≤ 5) elevators which travel up and down at (possibly) different speeds. For each i in {1, 2, . . . n}, elevator number i takes Ti (1 ≤ Ti ≤ 100) seconds to travel between any two adjacent floors (going up or down). Elevators do not necessarily stop at every floor. What’s worse, not every floor is necessarily accessible by an elevator. You are on floor 0 and would like to get to floor k as quickly as possible. Assume that you do not need to wait to board the first elevator you step

分治法POJ 1854

与世无争的帅哥 提交于 2020-02-03 01:55:40
分治法:POJ1854 Evil Straw Warts Live 问题: Description A palindrome is a string of symbols that is equal to itself when reversed. Given an input string, not necessarily a palindrome, compute the number of swaps necessary to transform the string into a palindrome. By swap we mean reversing the order of two adjacent symbols. For example, the string “mamad” may be transformed into the palindrome “madam” with 3 swaps: swap “ad” to yield “mamda” swap “md” to yield “madma” swap “ma” to yield “madam” Input The first line of input gives n, the number of test cases. For each test case, one line of input

PAT Advanced 1010 Radix(25) [⼆分法]

こ雲淡風輕ζ 提交于 2020-01-31 23:14:33
题目 Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer is “yes”, if 6 is a decimal number and 110 is a binary number. Now for any pair of positive integers N1 and N2, your task is to find the radix of one number while that of the other is given. Input Specification: Each input file contains one test case. Each case occupies a line which contains 4 positive integers: N1 N2 tag radix Here N1 and N2 each has no more than 10 digits. A digit is less than its radix and is chosen from the set {0-9, a-z} where 0-9 represent the decimal numbers 0-9,

codeforces 508E Arthur and Brackets

坚强是说给别人听的谎言 提交于 2020-01-30 04:45:41
题目描述: Notice that the memory limit is non-standard. Recently Arthur and Sasha have studied correct bracket sequences. Arthur understood this topic perfectly and become so amazed about correct bracket sequences, so he even got himself a favorite correct bracket sequence of length 2 n . Unlike Arthur, Sasha understood the topic very badly, and broke Arthur's favorite correct bracket sequence just to spite him. All Arthur remembers about his favorite sequence is for each opening parenthesis ('(') the approximate distance to the corresponding closing one (')'). For the i -th opening bracket he

Equidistant String

不羁的心 提交于 2020-01-26 10:17:51
Equidistant String Little Susie loves strings. Today she calculates distances between them. As Susie is a small girl after all, her strings contain only digits zero and one. She uses the definition of Hamming distance: We will define the distance between two strings s and t of the same length consisting of digits zero and one as the number of positions i, such that si isn’t equal to ti. As besides everything else Susie loves symmetry, she wants to find for two strings s and t of length n such string p of length n, that the distance from p to s was equal to the distance from p to t. It’s time

浙大PAT1010

China☆狼群 提交于 2020-01-12 06:49:30
1010. Radix (25) 时间限制 400 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer is "yes", if 6 is a decimal number and 110 is a binary number. Now for any pair of positive integers N1 and N2, your task is to find the radix of one number while that of the other is given. Input Specification: Each input file contains one test case. Each case occupies a line which contains 4 positive integers: N1 N2 tag radix Here N1 and N2 each has no more than 10 digits. A digit is less than its radix

PAT 解题报告 1010. Radix (25)

落花浮王杯 提交于 2020-01-11 16:02:03
1010. Radix (25) Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer is "yes", if 6 is a decimal number and 110 is a binary number. Now for any pair of positive integers N1 and N2, your task is to find the radix of one number while that of the other is given. Input Specification: Each input file contains one test case. Each case occupies a line which contains 4 positive integers: N1 N2 tag radix Here N1 and N2 each has no more than 10 digits. A digit is less than its radix and is chosen from the set {0-9, a-z} where 0-9 represent the decimal

Codeforces - Fox And Dinner

为君一笑 提交于 2019-12-28 09:11:33
Fox Ciel is participating in a party in Prime Kingdom. There are n foxes there (include Fox Ciel). The i-th fox is ai years old. They will have dinner around some round tables. You want to distribute foxes such that: Each fox is sitting at some table. Each table has at least 3 foxes sitting around it. The sum of ages of any two adjacent foxes around each table should be a prime number. If k foxes f1, f2, …, fk are sitting around table in clockwise order, then for 1 ≤ i ≤ k - 1: fi and fi + 1 are adjacent, and f1 and fk are also adjacent. If it is possible to distribute the foxes in the desired

PAT 1010 Radix 进制转换+二分法

十年热恋 提交于 2019-11-28 01:08:40
Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer is “yes”, if 6 is a decimal number and 110 is a binary number. Now for any pair of positive integers N1 and N2, your task is to find the radix of one number while that of the other is given. Input Specification: Each input file contains one test case. Each case occupies a line which contains 4 positive integers: N1 N2 tag radix Here N1 and N2 each has no more than 10 digits. A digit is less than its radix and is chosen from the set {0-9, a-z} where 0-9 represent the decimal numbers 0-9, and

I - Playing With Strings

这一生的挚爱 提交于 2019-11-27 15:42:57
Dani and Mike are two kids ,They are playing games all day and when they don’t find a game to play they invent a game . There is about an hour to arrive to school, because they love playing with strings Dani invented a game , Given a string and the winner is the first who form a palindrome string using all letters of this string according to the following sample rules : 1- player can rearrange letters to form a string . 2- the formed string must be palindrome and use all letters of the given string. 3- if there is more than one string chose the lexicographically smallest string . EX: string is