荔园在线

荔园之美,在春之萌芽,在夏之绽放,在秋之收获,在冬之沉淀

[回到开始] [上一篇][下一篇]


发信人: selahx (其实我是恶魔^_^), 信区: ACMICPC
标  题: 有好题……
发信站: 荔园晨风BBS站 (Fri Sep  3 08:25:35 2004), 站内信件


一道不难的题,不过花了我不少时间,主要是选错了算法,选了一种麻烦的。


                      Stringsobits
                      Kim Schrijvers

Consider an ordered set S of strings of N (1 <= N <= 31) bits. Bits, of
 course, are either 0 or 1.

This set of strings is interesting because it is ordered and contains a
ll possible strings of length N that have L (1 <= L <= N) or fewer bits
that are `1'.

Your task is to read a number I (1 <= I <= sizeof(S)) from the input an
d print the Ith element of the ordered set for N bits with no more than
L bits that are `1'.
PROGRAM NAME: kimbits
INPUT FORMAT
A single line with three space separated integers: N, L, and I.
SAMPLE INPUT (file kimbits.in)

5 3 19

OUTPUT FORMAT
A single line containing the integer that represents the Ith element fr
om the order set, as described.
SAMPLE OUTPUT (file kimbits.out)

10011

--
  oノ\ ╲╱  ;-\   o╲  ﹀--ˊ   当太阳下山后     我就变成恶魔
  /0 ヽ  "  /  0;     |0                      ◣
 (     ╲  /    \o   0\              `~  ``   █◣~~   ~~     哼哼
 o\     | .\    o╲o   0\              ~~     ██◣ ~~  ~    哈哈
  |0    /  /      0\    o╲   `~    ~~     ◥▄▄▄▄◤  ~
       /    \                  ~~~~~    ~~   ~~   ~~   ~~


[回到开始] [上一篇][下一篇]

荔园在线首页 友情链接:深圳大学 深大招生 荔园晨风BBS S-Term软件 网络书店