[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\).每次操作都有\ ...
随机推荐
- 关于Cookie的相关知识点以及使用方法
首先介绍cookie的一些方法 response.addCookie(Cookie cookie)是将一个cookie对象传入客户端. Cookie cookie=new Cookie(String ...
- 搭建环境-git常见使用总结
Descripton:git 一.Git安装和本地用户全局配置 官网下载并且安装 查看是否安装成功win + R输入git,出现git命令指南,则安装成功 全局配置本地用户,在git Bash中进行下 ...
- 22.1 Extends 继承的 方法重写、@Override的使用、
/* * 继承中成员方法的特点 * 子类中没有这个方法,调用父类的 * 子类中重写了这个方法,调用子类的 * 方法的重写:在子父类当中,子类的方法和父类的完全一样,子类重写了父类的方法(覆盖),当子类 ...
- Atlas运行时资源不足报错 -bash: fork: retry: 资源暂时不可用 Out of system resources
目的:运行Atlas并使用Azkaban执行操作任务 环境:Centos 6 内存大小:12G 启动下面的任务后还剩内存将近5G 问题: 当mysql_to_hdfs_db和其他job同时运行时集群很 ...
- B2 - TV Subscriptions (Hard Version)
题目连接:https://codeforces.com/contest/1247/problem/B2 题解:双指针,,一个头,一个尾,头部进入,尾部退出,一开始先记录1到k,并记录每个数字出现的次数 ...
- 对短路变形POJ3615
Farmer John wants the cows to prepare for the county jumping competition, so Bessie and the gang are ...
- python成语接龙小游戏
上一篇讲了小游戏的坑现在把源码放出来 #coding:utf-8 import string import pypinyin import sys import random print(" ...
- 自己写的一个HTML的小网页
上次在上直播课的时候,教员提到了html这种标记语言.自己就在W3school上面学了一点点关于html的一些皮毛,自己动手写了一个小网页,同时自己对CTF这一块比较感兴趣,但是自己还是一个干干净净的 ...
- Linux学习笔记(四)帮助命令
帮助命令 man info help --help man 英文原意:format and display the on-line manual pages 功能:显示联机帮助手册 语法:man 选项 ...
- 泛微ecology OA系统在数据库配置信息泄露
漏洞描述 攻击者可通过该漏洞页面直接获取到数据库配置信息,攻击者可通过访问存在漏洞的页面并解密从而获取数据库配置信息,如攻击者可直接访问数据库,则可直接获取用户数据,由于泛微e-cology默认数据库 ...