题目链接:http://codeforces.com/contest/1009/problem/A

解题心得:

  • 题意就是给你两个数列c,a,你需要从c中选择一个子串从a头开始匹配,要求子串中的连续的前k个数都要比对应的a中数小,问k最大是多少。
  • 大比赛的时候自己在枚举题意,搞了好久心态差点崩了。
    #include <bits/stdc++.h>
    using namespace std;
    const int maxn = ; int n,m;
    int a[maxn],c[maxn];
    void init() {
    scanf("%d%d",&n,&m);
    for(int i=;i<=n;i++)
    scanf("%d",&c[i]);
    for(int i=;i<=m;i++)
    scanf("%d",&a[i]);
    } void solve() {
    int ans = ;
    int last = ;
    for(int i=;i<=m;i++) {//暴力枚举匹配
    for(int j=last;j<=n;j++) {
    if(a[i] >= c[j]) {
    ans++;
    last = j+;
    break;
    }
    else{
    last = j+;
    }
    }
    }
    printf("%d",ans);
    }
    int main() {
    init();
    solve();
    return ;
    }

Educational Codeforces Round 47 (Rated for Div. 2) :A. Game Shopping的更多相关文章

  1. Educational Codeforces Round 47 (Rated for Div. 2) :E. Intercity Travelling

    题目链接:http://codeforces.com/contest/1009/problem/E 解题心得: 一个比较简单的组合数学,还需要找一些规律,自己把方向想得差不多了但是硬是找不到规律,还是 ...

  2. Educational Codeforces Round 47 (Rated for Div. 2) :D. Relatively Prime Graph

    题目链接:http://codeforces.com/contest/1009/problem/D 解题心得: 题意就是给你n个点编号1-n,要你建立m条无向边在两个互质的点之间,最后所有点形成一个连 ...

  3. Educational Codeforces Round 47 (Rated for Div. 2) :C. Annoying Present(等差求和)

    题目链接:http://codeforces.com/contest/1009/problem/C 解题心得: 题意就是一个初始全为0长度为n的数列,m此操作,每次给你两个数x.d,你需要在数列中选一 ...

  4. Educational Codeforces Round 47 (Rated for Div. 2) :B. Minimum Ternary String

    题目链接:http://codeforces.com/contest/1009/problem/B 解题心得: 题意就是给你一个只包含012三个字符的字符串,位置并且逻辑相邻的字符可以相互交换位置,就 ...

  5. Educational Codeforces Round 55 (Rated for Div. 2):E. Increasing Frequency

    E. Increasing Frequency 题目链接:https://codeforces.com/contest/1082/problem/E 题意: 给出n个数以及一个c,现在可以对一个区间上 ...

  6. Educational Codeforces Round 55 (Rated for Div. 2):D. Maximum Diameter Graph

    D. Maximum Diameter Graph 题目链接:https://codeforces.com/contest/1082/problem/D 题意: 给出n个点的最大入度数,要求添加边构成 ...

  7. Educational Codeforces Round 55 (Rated for Div. 2):C. Multi-Subject Competition

    C. Multi-Subject Competition 题目链接:https://codeforces.com/contest/1082/problem/C 题意: 给出n个信息,每个信息包含专业编 ...

  8. Educational Codeforces Round 47 (Rated for Div. 2) 题解

    题目链接:http://codeforces.com/contest/1009 A. Game Shopping 题目: 题意:有n件物品,你又m个钱包,每件物品的价格为ai,每个钱包里的前为bi.你 ...

  9. Educational Codeforces Round 47 (Rated for Div. 2)E.Intercity Travelling

    题目链接 大意:一段旅途长度N,中间可能存在N-1个休息站,连续走k长度时,疲劳值为a1+a2+...+aka_1+a_2+...+a_ka1​+a2​+...+ak​,休息后a1a_1a1​开始计, ...

随机推荐

  1. htmlunit模拟登录

    htmlunit jar项目路径http://sourceforge.net/projects/htmlunit/files/htmlunit/ demo代码如下 public class AutoL ...

  2. java带jar包的命令行运行

    运行有些java类需要第三方的jar包(lib),在用命令行运行时本人总结如下几个方法: 方法一.编译  javac -cp D:\lab\googleapi.jar Lab.java设置classp ...

  3. TP5.0:新建控制器

    例如,我们在admin模块下创建一个名为OneMenu.php的控制器 1.在该控制器文件中内容为: 2.访问的URL为:http://localhost/tp5/public/index.php/a ...

  4. JS interview loop code

    //九九乘法表 document.write("<table width='600' border=0'>"); for(var i=1; i<=9; i++){ ...

  5. zip4j之加压解压

    最近看同事搞个文件打包,搞了大半天,还是有问题!嗨~~ 网上明明有现成的,偏偏要自己写! 下面是基于zip4j实现加压解决的简单工具类 package com.learcher.zip; import ...

  6. 使用DOM Breakpoints找到修改属性的Javascript代码

    使用Chrome开发者工具的DOM断点功能可以让您快速找到修改了某一个DOM元素的Javascript代码. 在Chrome开发者工具里,选中想要监控的DOM元素,点击右键,选择Break on-&g ...

  7. Uva 11396 爪分解

    题目链接:https://vjudge.net/contest/166461#problem/A 题意: 给定一个图,特点是每个点的度都是3,求是不是原图可以分解为全部鸡爪:每条边只属于一个鸡爪: 分 ...

  8. 【iOS】那些年,遇到的小坑

    'NSInvalidArgumentException', reason: '-[__NSPlaceholderDictionary initWithObjectsAndKeys:]: second ...

  9. TridentState分析

    public class TridentState { TridentTopology _topology; Node _node; protected TridentState(TridentTop ...

  10. java循环作业0912

    题目一:一张纸的厚度大约是0.08mm,对折多少次之后能达到珠穆朗玛峰的高度(8848.13米)? double a = 0.08; double h =0; int i=0; for(i=1;h&l ...