这题看了网上的答案的。还是很巧妙的

 /*
 ID: yingzho1
 LANG: C++
 TASK: kimbits
 */
 #include <iostream>
 #include <fstream>
 #include <string>
 #include <map>
 #include <vector>
 #include <set>
 #include <algorithm>
 #include <stdio.h>
 #include <queue>
 #include <cstring>
 #include <cmath>
 #include <list>
 #include <cstdio>
 #include <cstdlib>

 using namespace std;

 ifstream fin("kimbits.in");
 ofstream fout("kimbits.out");

 ;

 int N, L;
 long long I;

 int main()
 {
     fin >> N >> L >> I;
     vector<vector<, vector<));
     ; i <= N; i++) f[i][] = ;
     ; i <= N; i++) {
         ; j <= i; j++) {
             f[i][j] = f[i-][j-] + f[i-][j];
         }
     }
     ; i <= N; i++) {
         ; j <= N; j++) {
             f[i][j] += f[i][j-];
         }
     }
     ; i--) {
         ][L] >= I) fout << ";
         else {
             fout << ";
             I -= f[i-][L--];
         }
     }
     fout << endl;

     ;
 }

USACO Section 3.2: Stringsobits的更多相关文章

  1. USACO Section 3.2 01串 Stringsobits

    题目背景 考虑排好序的N(N<=31)位二进制数. 题目描述 他们是排列好的,而且包含所有长度为N且这个二进制数中1的位数的个数小于等于L(L<=N)的数. 你的任务是输出第i(1< ...

  2. [USACO Section 3.2] 01串 Stringsobits (动态规划)

    题目链接 Solution 贼有意思的 DP, 也可以用组合数学做. \(f[i][j]\) 代表前 \(i\) 位,有 \(j\) 个 \(1\) 的方案数. 转移方程很简单 : \(f[i][j] ...

  3. USACO Section 1.3 题解 (洛谷OJ P1209 P1444 P3650 P2693)

    usaco ch1.4 sort(d , d + c, [](int a, int b) -> bool { return a > b; }); 生成与过滤 generator&& ...

  4. USACO Section 3.3: Riding the Fences

    典型的找欧拉路径的题.先贴下USACO上找欧拉路径的法子: Pick a starting node and recurse on that node. At each step: If the no ...

  5. USACO Section 3.3 Camlot(BFS)

    BFS.先算出棋盘上每个点到各个点knight需要的步数:然后枚举所有点,其中再枚举king是自己到的还是knight带它去的(假如是knight带它的,枚举king周围的2格(网上都这么说,似乎是个 ...

  6. [IOI1996] USACO Section 5.3 Network of Schools(强连通分量)

    nocow上的题解很好. http://www.nocow.cn/index.php/USACO/schlnet 如何求强连通分量呢?对于此题,可以直接先用floyd,然后再判断. --------- ...

  7. USACO Section 5.3 Big Barn(dp)

    USACO前面好像有类似的题目..dp(i,j)=min(dp(i+1,j),dp(i+1,j+1),dp(i,j+1))+1  (坐标(i,j)处无tree;有tree自然dp(i,j)=0) .d ...

  8. USACO Section 1.3 Prime Cryptarithm 解题报告

    题目 题目描述 牛式的定义,我们首先需要看下面这个算式结构: * * * x * * ------- * * * <-- partial product 1 * * * <-- parti ...

  9. USACO Section 1.1 Your Ride Is Here 解题报告

    题目 问题描述 将字符串转变为数字,字母A对应的值为1,依次对应,字母Z对应的值为26.现在有一个字符串,将其中的每个字符转变为数字之后进行累乘,最终的结果对47求余数. 题目给你两个字符串,其中的字 ...

随机推荐

  1. 【Merge Sorted Array】cpp

    题目: Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Not ...

  2. 关于VS2010中一打字,换行,拖控件便出现卡死的问题的解决方案

    大家好,这是我第一篇博文. 最近一个月都是静静的观看,想发帖子很久了. 最近实习完刚换了份工作,入职之后啊先是装了一堆软件.然后,便出现问题,就是VS2010上码字和切换页面的时候会卡.开始的时候每次 ...

  3. 4.C#基础篇-->变量

    一.前言 变量的类型划分即内存中的存放位置如图: 变量的生命周期如图:

  4. 设计模式之享元模式(FlyWeight)

    #include <iostream> #include <string> #include <list> #include <vector> usin ...

  5. 【BZOJ】【1269】【AHOI2006】文本编辑器editor

    Splay Splay序列维护的模板题了……为了便于处理边界情况,我们可以先插入两个空格当作最左端和最右端,然后……其实本题主要考察的就是Build.splay和Findkth这三个操作,我们可以实现 ...

  6. winform 记录全局异常捕获

    这篇文章主要是备用 记录winform程序捕获全局异常. /// <summary> /// 应用程序的主入口点. /// </summary> public static A ...

  7. PIX的使用

    这几天pix的一个问题可坑死我了,之前用的时候有蓝色的链接,点过去就可以查看相应资源,后来都是黑色的了没有可以点的链接. 看文档翻来翻去也没进展,后来找到了, 先打开render那个窗口 这样even ...

  8. poj 1185

    上一题的升级版 dp[i][j][k] 表示第 i 行状态为 k 第i-1行状态为 j #include <cstdio> #include <cstdlib> #includ ...

  9. lagstash + elasticsearch + kibana 3 + kafka 日志管理系统部署 02

    因公司数据安全和分析的需要,故调研了一下 GlusterFS + lagstash + elasticsearch + kibana 3 + redis 整合在一起的日志管理应用: 安装,配置过程,使 ...

  10. mysql 权限 备份

    mysqldump常用于MySQL数据库逻辑备份. 1.各种用法说明 A. 最简单的用法: mysqldump -uroot -pPassword [database name] > [dump ...