[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\).每次操作都有\ ...
随机推荐
- MAC中PHP7.3安装mysql扩展
1.下载mysql扩展http://git.php.net/?p=pecl/database/mysql.git;a=summary 2.解压tar xzvf mysql-d7643af.tar.gz ...
- 线程池:Execution框架
每问题每线程:在于它没有对已创建线程的数量进行任何限制,除非对客户端能够抛出的请求速率进行限制. 下边 有些图片看不到,清看原地址:http://www.360doc.com/content/10/1 ...
- lambda表达式,及lambda简化过程
lambda表达式(jdk8特性) 1.为什么要用lambda表达式 原因:因为我们有时候需要用到很多类,但是,这些类我们只用一次或者两次,所以我们用匿名内部类,但是匿名内部类多了还是很麻烦,所以用l ...
- 01-css3之过渡
一.介绍 过渡(transition)是CSS3中具有颠覆性的特征之一,我们可以在不使用 Flash 动画或 JavaScript 的情况下,当元素从一种样式变换为另一种样式时为元素添加效果,经常和 ...
- cheat sheet 简介
cheat sheet 速查表 /小抄 如果期末考试老师只让你让带一张A4纸,合法"作弊",纸上能写多少全凭自己本事,你会写什么?大部分人应该把整个课程的知识重点梳理一遍,方便记忆 ...
- sorted排序的两个方法 - Python
在给列表排序时,sorted非常好用,语法如下: sorted(iterable[, cmp[,key[,reverse]]]) 简单列表排序,很容易完成,sorted(list)返回的对象就是列表结 ...
- jmeter DB2数据库连接与操作
1.需要把数据库连接jar包拷贝到 jmeter lib目录下 先创建一个数据库连接配置元件 2.添加jdbc请求(我用的后置处理器) 3.可以通过beanshell 对结果集进行操作 beanshe ...
- 通过 Swoole\Table 实现 Swoole 多进程数据共享
第三方存储媒介 前面我们介绍了基于 Swoole 的 Process 及 Process\Pool 模块在 PHP 中实现多进程管理,但是多进程模式下进程间是相互隔离的,无法共享数据和变量,即便是通过 ...
- redis: 其他数据类型(八)
1.geospatial 地理位置 有效的经度从-180度到180度 有效的纬度从-85.05112878度到85.05112878度 当坐标位置超出上述指定范围时,该命令将会返回一个错误 底层实现原 ...
- Neo4J 查找两节点之间的路径
# 两节点之间的所有路径MATCH p=(a)-[*]->(b)RETURN p # a->b 直接连接MATCH p=(a)-[]->(b)RETURN p # a-...> ...