「topcoder」Kodifica – Pratice Round 1

2015年3月11日5,9360

打了场莫名其妙的比赛

150

You need to update the balance in your checkbook. You know your starting balance, the total amount spent using your debit card, and the total value of checks that have been written. Return your ending balance.

a-b-c。。。

500

Preparing a national budget involves sums of large numbers. These numbers should be formatted in a nice way. Your task is, given some nicely formatted costs (in US dollars and cents), add up the costs and return the nicely formatted total cost.  The nice format is: Numbers are decimal (base ten). Always display the cents as two digits to the right of the decimal point, even if this gives trailing zeros. Always display at least one digit to the left of the decimal point. Unless the absolute value of the number is less than one dollar, use no leading zeros. If the absolute value of the number is less than one dollar there should be one zero to the left of the decimal point. If the number of digits to the left of the decimal point is five or more, then insert commas between groups of three digits from right to left from the decimal point. (see examples) If the number is positive (greater than or equal to zero) the first character is “$”. If the number is negative (strictly less than zero) then the first two characters are “-$”.

计算一堆money的和。。。FST了TAT

改了竟然 没 地 方 交 !!!

Cat Taro likes lucky strings. The digits 4 and 7 are considered lucky. A lucky string is a string such that each of its characters is a lucky digit (i.e., either ‘4’ or ‘7’). Consider some lucky string S. In one turn Taro can swap any two (not necessarily consecutive) characters of that string. He considers the string S very lucky if its characters can be sorted into non-decreasing order using at most K turns. You are given two ints N and K. Let X be the number of different very lucky strings of length N. Return the value (X modulo 1,000,000,007).

枚举放了i个4,再枚举前i个中有j个4,则交换次数为j,方案数排列组合算一算

 

avatar
  Subscribe  
提醒