A - “atcoder“.substr()【AtCoder Beginner Contest 264】

本文介绍了AtCoder Beginner Contest 264中A题的解决方案,题目要求打印字符串'atcoder'中从L到R的字符,对输入格式、输出格式及样例进行了说明。
摘要由CSDN通过智能技术生成

A - "atcoder".substr()

Time Limit: 2 sec / Memory Limit: 1024 MB

Score : 100 points

Problem Statement

Print the L-th through R-th characters of the string atcoder.

Constraints

  • L and R are integers.
  • 1 ≤ L ≤ R ≤ 7

Input

Input is given from Standard Input in the following format:

L R

Output

Print the answer.


Sample Input 1

Copy

3 6

Sample Output 1

code

The 3-rd through 6-th characters of atcoder are code.


Sample Input 2

4 4

Sample Output 2

o

Sample Input 3

1 7

Sample Output 3

atcoder

代码(AC):

#include<bits/stdc++.h>
using namespace std;
int main() {
	string s="atcoder";
	int l,r;
	cin>>l>>r;
	cout<<s.substr(l-1,r-l+1); 
	
	return 0;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值