[CodeForces-259C] Little Elephant and Bits
2 seconds
256 megabytes
standard input
standard output
The Little Elephant has an integer a, written in the binary notation. He wants to write this number on a piece of paper.
To make sure that the number a fits on the piece of paper, the Little Elephant ought to delete exactly one any digit from number a in the binary record. At that a new number appears. It consists of the remaining binary digits, written in the corresponding order (possible, with leading zeroes).
The Little Elephant wants the number he is going to write on the paper to be as large as possible. Help him find the maximum number that he can obtain after deleting exactly one binary digit and print it in the binary notation.
The single line contains integer a, written in the binary notation without leading zeroes. This number contains more than 1 and at most 105digits.
In the single line print the number that is written without leading zeroes in the binary notation — the answer to the problem.
101
11
110010
11010
In the first sample the best strategy is to delete the second digit. That results in number 112 = 310.
In the second sample the best strategy is to delete the third or fourth digits — that results in number 110102 = 2610.
#include<bits/stdc++.h>
#define N 100005
using namespace std;
typedef long long ll;
int main(){
char a[N];
int flag=-;
cin>>a;
int len=strlen(a);
for(int i=;i<len;i++){
if(a[i]==''){ flag=i;
break;
}
}
if(flag==-)flag=len-;
for(int i=;i<len;i++)
{
if(flag==i)continue;
cout<<a[i]; } return ;
}
[CodeForces-259C] Little Elephant and Bits的更多相关文章
- CodeForces - 204C Little Elephant and Furik and Rubik
CodeForces - 204C Little Elephant and Furik and Rubik 个人感觉是很好的一道题 这道题乍一看我们无从下手,那我们就先想想怎么打暴力 暴力还不简单?枚 ...
- Codeforces D. Little Elephant and Interval(思维找规律数位dp)
题目描述: Little Elephant and Interval time limit per test 2 seconds memory limit per test 256 megabytes ...
- CodeForces 221D Little Elephant and Array
Little Elephant and Array Time Limit: 4000ms Memory Limit: 262144KB This problem will be judged on C ...
- CodeForces 259A Little Elephant and Chess
Little Elephant and Chess Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d &am ...
- Codeforces 258D Little Elephant and Broken Sorting (看题解) 概率dp
Little Elephant and Broken Sorting 怎么感觉这个状态好难想到啊.. dp[ i ][ j ]表示第 i 个数字比第 j 个数字大的概率.转移好像比较显然. #incl ...
- Codeforces 258C Little Elephant and LCM
Little Elephant and LCM #include<bits/stdc++.h> #define LL long long #define fi first #define ...
- [Codeforces 204E] Little Elephant and Strings
[题目链接] https://codeforces.com/contest/204/problem/E [算法] 首先构建广义后缀自动机 对于自动机上的每个节点 , 维护一棵平衡树存储所有它所匹配的字 ...
- CodeForces - 258D Little Elephant and Broken Sorting
Discription The Little Elephant loves permutations of integers from 1 to n very much. But most of al ...
- CodeForces 258D Little Elephant and Broken Sorting(期望)
CF258D Little Elephant and Broken Sorting 题意 题意翻译 有一个\(1\sim n\)的排列,会进行\(m\)次操作,操作为交换\(a,b\).每次操作都有\ ...
随机推荐
- sqlchemy查询的其他操作
sqlalchemy的数据查询排序 1 .正序排序:session.query(model).order_by(model.attr).all() session.query(model).order ...
- MySQL入门,第八部分,多表查询(二)
嵌套查询 嵌套查询是指一个SELECT-FROM-WHERE查询块嵌入在另一个SELECT-FROM-WHERE查询块的WHERE子句中的查询 注意: 只有当连接查询投影列的属性来自于一个关系表时才能 ...
- python 性能测试
python中使用的性能测试模块是memory_profiler , 我们使用它里面的profile这个装饰器即可测试出我们的代码的内存使用情况了. 如果没有安装 memory_p ...
- 数据结构和算法(Golang实现)(8.1)基础知识-前言
基础知识 学习数据结构和算法.我们要知道一些基础的知识. 一.什么是算法 算法(英文algorithm)这个词在中文里面博大精深,表示算账的方法,也可以表示运筹帷幄的计谋等.在计算机科技里,它表示什么 ...
- IDEA我常用的快捷键
IDEA快捷键 全屏编写代码:Ctrl+Shift+F12
- AJ学IOS 之微博项目实战(2)微博主框架-自定义导航控制器NavigationController
AJ分享,必须精品 一:添加导航控制器 上一篇博客完成了对底部的TabBar的设置,这一章我们完成自定义导航控制器(NYNavigationController). 为啥要做自定义呢,因为为了更好地封 ...
- svg 实践之屏幕坐标与svg元素坐标转换
近期在做svg相关项目,很好用的东西要记下来: 1.基础知识就是根据 矩阵进行坐标转换,如下: : 屏幕坐标 = 矩阵* svg对象坐标 2.javascript有个方法用于获取 svg对象 的转换矩 ...
- 1324E - Sleeping Schedule
题目大意:一天有h个小时,一个人喜欢睡觉,一共睡n次,每次都睡h个小时,开始时间为0,间隔a[i]或a[i]-1个小时开始睡第i次觉,每天都有一个最好时间区间,问这n次觉,最多有多少次是在最好时间内睡 ...
- vue2.x学习笔记(五)
接着前面的内容:https://www.cnblogs.com/yanggb/p/12571062.html. 计算属性 模板内的表达式非常便利,但是设计它们的初衷是用于简单运算的.如果在模板中放入太 ...
- file_put_contens小trick
file_put_contents tricks 0x01 trick1 来自于P神的实例: <?php $text = $_GET['text']; if(preg_match('[<& ...