Codeforces Round #271 (Div. 2)

基于libVLC的视频播放器之四:直接使用libVLC 一.效果 播放本地文件 播放网络url:rtsp://3.84.6.190/vod/mp4:BigBuckBunny_115k.mov 二.实现 既然有VLC-Qt,为什么还要直接调用libVLC呢,因为直接调用会加深对整个播放流程的理解,方便后面修改VLC-Qt源码。 注意事项: 1.编译报错:error C2065: “libvlc_media_read_cb”: 未声明的标识符。修改如下: 2.libvlc_new(0, nullptr)返回null 将plugins 阅读详情
A. Keyboard
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Our good friend Mole is trying to code a big message. He is typing on an unusual keyboard with characters arranged in following way:

qwertyuiop
asdfghjkl;
zxcvbnm,./

Unfortunately Mole is blind, so sometimes it is problem for him to put his hands accurately. He accidentally moved both his hands with one position to the left or to the right. That means that now he presses not a button he wants, but one neighboring button (left or right, as specified in input).

We have a sequence of characters he has typed and we want to find the original message.

Input

First line of the input contains one letter describing direction of shifting ('L' or 'R' respectively for left or right).

Second line contains a sequence of characters written by Mole. The size of this sequence will be no more than 100. Sequence contains only symbols that appear on Mole's keyboard. It doesn't contain spaces as there is no space on Mole's keyboard.

It is guaranteed that even though Mole hands are moved, he is still pressing buttons on keyboard and not hitting outside it.

Output

Print a line that contains the original message.

Sample test(s)
input
R
s;;upimrrfod;pbr
output
allyouneedislove

直接模拟即可


#include<iostream>
#include<cstdio>
#include<cmath>
#include<queue>
#include<stack>
#include<vector>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
const int INF=100000000;
const int N=110;
char s[N],ss[N];
int main()
{
    char ch;
    char str[N];
    strcpy(str,"qwertyuiopasdfghjkl;zxcvbnm,./");
    while(scanf("%c",&ch)!=EOF)
    {
        getchar();
        gets(s);
        int len=strlen(s);
        //puts(str);
        if(ch=='L')
        {
            for(int i=0;i<len;i++)
            {
                int cnt=strchr(str,s[i])-str;
                ss[i]=str[cnt+1];
            }
        }
        else
        {
            //cout<<"in"<<endl;
            for(int i=0;i<len;i++)
            {
                int cnt=strchr(str,s[i])-str;
                //cout<<"cnt="<<cnt<<endl;
                ss[i]=str[cnt-1];
            }
        }
        ss[len]='\0';
        puts(ss);


    }
    return 0;
}





B. Worms
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.

Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers a1 + 1 to a1 + a2 and so on. See the example for a better understanding.

Mole can't eat all the worms (Marmot brought a lot) and, as we all know, Mole is blind, so Marmot tells him the labels of the best juicy worms. Marmot will only give Mole a worm if Mole says correctly in which pile this worm is contained.

Poor Mole asks for your help. For all juicy worms said by Marmot, tell Mole the correct answers.

Input

The first line contains a single integer n (1 ≤ n ≤ 105), the number of piles.

The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 103, a1 + a2 + ... + an ≤ 106), where ai is the number of worms in the i-th pile.

The third line contains single integer m (1 ≤ m ≤ 105), the number of juicy worms said by Marmot.

The fourth line contains m integers q1, q2, ..., qm (1 ≤ qi ≤ a1 + a2 + ... + an), the labels of the juicy worms.

Output

Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is.

Sample test(s)
input
5
2 7 3 4 9
3
1 25 11
output
1
5
3
Note

For the sample input:

  • The worms with labels from [1, 2] are in the first pile.
  • The worms with labels from [3, 9] are in the second pile.
  • The worms with labels from [10, 12] are in the third pile.
  • The worms with labels from [13, 16] are in the fourth pile.
  • The worms with labels from [17, 25] are in the fifth pile.


sum[i] 为前 i 项的和,lower_bound判断一下就行

#include<iostream>
#include<cstdio>
#include<cmath>
#include<queue>
#include<stack>
#include<vector>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
const int INF=100000000;
const int N=100010;
int a[N],sum[N];
int main()
{
    int n,q;
    while(~scanf("%d",&n))
    {
        sum[0]=0;
        for(int i=1;i<=n;i++)
        {
            scanf("%d",&a[i]);
            sum[i]=sum[i-1]+a[i];
        }
        scanf("%d",&q);
        while(q--)
        {
            int t;
            scanf("%d",&t);
            int cnt=lower_bound(sum+1,sum+1+n,t)-sum;
            printf("%d\n",cnt);
        }
    }
    return 0;
}





















































































无人驾驶Autoware导读 认知有限,望大家多多包涵,有什么问题也希望能够与大家多交流,共同成长!本文先对无人驾驶Autoware介绍做个简单的介绍,具体内容后续再更,其他模块可以参考去我其他文章提示:以下是本篇文章正文内容。 阅读详情

相关推荐

OpenCV函数用法之calibrateCamera

参考链接:opencv中标定函数calibrateCamera_ychl87的专栏-优快云博客 世界坐标系的三维点投影到成像坐标系中的二维点的投影公式如下: 其中(X,Y,Z)为世界坐标系中的三维点; (u,v)为成像面坐标系中的二维点; A为相机的内参数矩阵:(cx,cy)为主光轴点,一般为图像的中心;fx和fy为焦距; [R|t]为相机的外参数矩阵:R为旋转矩阵,t为位移矩阵; 上述公式的简单推理过程如下 考虑到镜头畸变 其中,k1,k2,k3,k4,k5和k6为径向畸变,p1和.

tiger&sheep的博客 3万+

Codeforces Round #271 (Div. 2) 总结

A. Keyboard time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Our good friend Mole is trying to code a big me

小马的博客 774

手把手教你用VMware虚拟机搭建PCAN开发环境:从Ubuntu安装到CAN通讯实战

本文详细指导如何在VMware虚拟机中搭建PCAN开发环境,涵盖从Ubuntu系统安装、VMware精细配置、PCAN-USB设备直通,到Linux驱动编译、can-utils工具集使用及完整CAN通讯测试的全过程。通过实战步骤与故障排查技巧,帮助开发者快速构建稳定高效的CAN总线开发与测试沙盒,特别适合车载诊断与嵌入式通讯应用。

weixin_29216353的博客 225

Codeforces Round #271 (Div. 2)(A,B,C(思维+几何),D(dp),E(线段树维护序列F 线段树+主席树)

题目链接 挑了一场远古场,没想到战绩还不错,直接五题: A. Keyboard 题意:给你一个键盘,但是Mole会打错,要么都往左边打了,要么都往右边打了,现在第一行输入 L或R代表往左和往右,然后一行字符串,代表打出来的字符,让你求原来的字符 qwertyuiop asdfghjkl; zxcvbnm,./ 做法:简单模拟一下就可以了。 #include<bits/...

ccsu_deer 1337

从MRF8P9040N数据手册到ADS仿真:手把手教你搞定LDMOS功放设计(附完整模型下载)

本文详细解析了MRF8P9040N LDMOS功率放大器的数据手册关键参数,并提供了在ADS中进行仿真的完整指南。从模型导入、直流工作点验证到负载牵引与阻抗匹配设计,逐步指导工程师完成高效功放设计。文章还包含调试技巧和常见问题解决方案,帮助优化射频功放性能。

weixin_27015733的博客 490

微信H5网页授权通用方案:中转页破解域名限制,适配Hash/History路由

在Web开发中,OAuth 2.0授权码模式是实现第三方登录的通用标准,其核心原理是通过授权服务器颁发临时代码,再由客户端交换访问令牌。这一机制在微信公众号H5开发中尤为重要,用于安全获取用户身份。然而,微信平台对网页授权回调域名有严格的数量限制,这成为多子域名、多环境及微前端架构下业务扩展的主要瓶颈。其技术价值在于通过设计一个统一的中转授权页,将授权逻辑与业务逻辑解耦,让所有业务页面共享一个已配置的授权入口,从而突破域名配额限制。该方案的关键在于适配不同的前端路由模式,需精准处理Hash模式与Histor

weixin_42533120的博客 318

B. Worms Codeforces Round #271 (div2)

B. Worms time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output It is lunch time for Mole. His friend, Marmot, prep

ACway的专栏 1421

MT25QL256完整操作指南:从ID读取到4KB扇区擦除(附华大SPI例程)

本文提供了MT25QL256 NOR FLASH在华大MCU上的完整驱动开发指南。内容涵盖从SPI初始化、器件ID读取、状态寄存器查询,到核心的页编程和4KB扇区擦除操作,并分享了构建健壮驱动框架、处理跨页写入及常见调试问题的实战经验。

tt34567的博客 886

codeforces Round #271(div2) D解题报告

D. Flowers time limit per test 1.5 seconds memory limit per test 256 megabytes input standard input output standard output We saw the little game Marmot made for Mole's

旅行者西瓜 875

Python中的串口通信库pyserial(基础)

pyserial是一个跨平台的库,可以在多个操作系统上使用,包括Windows、Linux和MacOS。:flushInput方法用于清除输入缓冲区中的所有数据,flushOutput方法用于清除输出缓冲区中的所有待发送数据。:PySerial允许在创建Serial对象后,通过修改对象的属性来设置串口参数,如波特率、数据位、校验位和停止位。同时,也提供了方法或属性来检查串口的状态,如是否已打开。:sendBreak方法用于向串口发送一个BREAK信号,这可以用于向连接的设备发送一个中断或重置信号。

weixin_44217158的博客 1万+

倒立摆的PLC控制(模型分析+ SCL源代码)

首先简单介绍下倒立摆模型,下面这幅图是MATLAB网站上的倒立摆模型,下面我们利用牛顿第二运动定律建立摆杆的运动方程。

RXXW_Dor的博客 3335

Codeforces Round #271 (Div. 2) F - Ant colony 线段树 + GCD

Codeforces Round #271 (Div. 2) F - Ant colony 题意: 给定一个序列  有M个提问 每次提问求   给定区间中有多少个数   不能整除区间中其他的数  至少有一次. 思路: 题意转化一下就是求区间中有多少个数能整除其他数. 其实这个数就是区间的gcd   于是我们只要在求出区间中这个数的个数即可. 对于后者   学习到一个新方法   记

Code of Duty 683

【AUTOSAR-RTE】-1-聊一聊RTE(Run-Time Environment)

RTE(Run-Time Environment)是AUTOSAR ECU架构的核心。

「汽车电子助手」的博客 6502

Codeforces Round #271 (Div. 2)题解【ABCDEF】

Codeforces Round #271 (Div. 2) A - Keyboard 题意 给你一个字符串,问你这个字符串在键盘的位置往左边挪一位,或者往右边挪一位字符,这个字符串是什么样子 题解 模拟一下就好了 代码 #include<bits/stdc++.h> using namespace std; string s[3]; map<char,int>r,c; c...

weixin_30379973的博客 135

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

Codeforces Round #271 (Div. 2), problem: (D) Flowers 【DP+前缀和+取模运算】

Codeforces Round #271 (Div. 2), problem: (D) Flowers 题目大意 土拨鼠???反正大概意思是拿红花或者k个白花,那么对于dp [ i ] =dp [ i - 1 ] + dp [ i - k ] 对于第 i 个长度 可以是之前最后一个红花或者k个白花 题解 题目给你的a 和 b 是一个区间范围的方法值 所以我们对我们求出的dp数组还要...

超逸の学习技术博客 743

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

Codeforces Round #166 (Div. 2) 271D

Codeforces Round #166 (Div. 2) 271D Problem Description You’ve got string s, consisting of small English letters. Some of the English letters are good, the rest are bad. A substring s[l…r] (1 ≤ l ≤ r ...

BenFromHRBUST的优快云博客 231

SIMATIC S7-1200, S7-1500 PID 控制[手册]

SIMATIC S7-1200, S7-1500 PID 控制[手册]

Codeforces Round #271 (Div. 2) 解题报告

题目地址:http://codeforces.com/contest/474 A题:Keyboard 模拟水题。 代码如下: #include #include #include #include #include #include #include #include #include #include #include using namespace std;

scf0920 1110

【Codeforces】Codeforces Round #271 div2

A: B: C: D: E: F:

poursoul 1304

Codeforces Round #271 (Div. 2) D

D. Flowers         题意:

A Cube Master 523

D. Flowers Codeforces Round #271(div2)

D. Flowers time limit per test 1.5 seconds memory limit per test 256 megabytes input standard input output standard output We saw the little game Marmot made for Mole's

ACway的专栏 1526

codeforces Round #271(div2) B解题报告

B. Worms time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output It is lunch time for Mole. His friend, Marmot, prep

旅行者西瓜 834

Codeforces Round #271 (Div. 2) C

C. Captain Marmot 题意:给4个点和它们各自的xuan

A Cube Master 584
上一篇: bc7 Little Pony and Permutation
下一篇: 每天一个linux命令(1):ls命令
IT旅行
博客等级 码龄12年 3粉丝 28原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值