标签归档:map

[bzoj 1054][HAOI2008] 移动玩具

Description

  在一个4*4的方框内摆放了若干个相同的玩具,某人想将这些玩具重新摆放成为他心中理想的状态,规定移动时只能将玩具向上下左右四个方向移动,并且移动的位置不能有玩具,请你用最少的移动次数将初始的玩具状态移动到某人心中的目标状态。

继续阅读

AOJ Challenge Problems 1

Anagrammatic Primes

A number is "prime" if it has no divisors other than itself and 1. For example, 23 is prime but 35 is not prime because 35 = 7 x 5. If the digits of a number are rearranged, then usually its primeness changes — for example, 35 is not prime but 53 is. For this problem, you must find numbers which are prime no matter how you rearrange their digits. For example, all of the numbers 113, 131 and 311 are prime, so we say that 113 is an "anagrammatic prime" (also 131 and 311 are anagrammatic primes).

继续阅读

[Codeforces 113B] Petr

Description

Long ago, when Petya was a schoolboy, he was very much interested in the Petr# language grammar. During one lesson Petya got interested in the following question: how many different continuous substrings starting with the sbegin and ending with the send (it is possible sbegin = send), the given string t has. Substrings are different if and only if their contents aren't equal, their positions of occurence don't matter. Petya wasn't quite good at math, that's why he couldn't count this number. Help him!

继续阅读

CodeForces Round #350 Solution

这场比赛比较水,但是细节比较多,而我没考虑T_T

一个是先入为主坑了我的B题,我没有计算时间复杂度而导致采用了较繁而且容易挂的算法,wa了4发

C题是因为我没能考虑到特殊情况而苦于wa on 14,7 times

如果没有这两个错误说不定能大涨分= =

这些错误都是值得我思考以及改正的,好了,切入正题

继续阅读