[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\).每次操作都有\ ...
随机推荐
- Linux网络安全篇,FTP服务器的架设
一.FTP简介 FTP基于TCP协议.而且FTP服务器使用了命令通道和数据流通道两个连接.两个连接都会分别进行三次握手.在命令通道中客户端会随机取一个大于1024的端口与FTP服务器的21端口建立连接 ...
- 安卓开发学习日记 DAY3——TextView,EditView,ImageView
今天学习了一些控件的使用方法,包括TextView,EditView,ImageView 1.TextView,输出一个文本呗 主要属性有 android:id 标志 android:layout_w ...
- python3中的nonlocal 与 global
nonlocal 与 global nonlocal翻译是非本地,global翻译是全局,它们都是python3的新特性.如果以类C语言的思维去看这2个关键字,很可能觉得它们差不多.但实际上它们很不一 ...
- 07-JDBC协议
1.下载mysql-connector-java-8.0.17.jar,jar包放进jmeter的安装目录lib文件夹下,启动jmeter就好 2.新增线程组,然后添加配置元件:JDBC connec ...
- 双色球的Python实现
代码如下: red_ball = [] blue_ball = [] count = 0 while count < 6: n = int(input('\033[31mPlease enter ...
- H5 环境检测
检测是否在客户端App内 function is_app() { var userAgent = navigator.userAgent.toLowerCase();//获取UA信息 if (user ...
- 【原创】关于java对象需要重写equals方法,hashcode方法,toString方法 ,compareto()方法的说明
在项目开发中,我们都有这样的经历,就是在新增表时,会相应的增加java类,在java类中都存在常见的几个方法,包括:equals(),hashcode(),toString() ,compareto( ...
- JS数据结构与算法 - 剑指offer二叉树算法题汇总
❗❗ 必看经验 在博主刷题期间,基本上是碰到一道二叉树就不会碰到一道就不会,有时候一个下午都在搞一道题,看别人解题思路就算能看懂,自己写就呵呵了.一气之下不刷了,改而先去把二叉树的基础算法给搞搞懂,然 ...
- java nio消息半包、粘包解决方案
问题背景 NIO是面向缓冲区进行通信的,不是面向流的.我们都知道,既然是缓冲区,那它一定存在一个固定大小.这样一来通常会遇到两个问题: 消息粘包:当缓冲区足够大,由于网络不稳定种种原因,可能会有多条消 ...
- OkHttp 优雅封装 HttpUtils 之 上传下载解密
曾经在代码里放荡不羁,如今在博文中日夜兼行,只为今天与你分享成果.如果觉得本文有用,记得关注我,我将带给你更多. 还没看过第一篇文章的欢迎移步:OkHttp 优雅封装 HttpUtils 之气海雪山初 ...