258A. Little Elephant and Bits
来源:互联网 发布:新倩女幽魂辅助软件 编辑:程序博客网 时间:2024/05/17 01:36
题源:CodeForces#258A
分析:输入一个长度为1~105,取值范围为 1 ~10^5 的二进制数,删掉其中一位,使剩余组成的新二进制数最大,输出最大的新二进制数。
如果原二进制数有0,则删除第一个0即可,如果全为1,则删除一个1即可。
#include <bits/stdc++.h>using namespace std;int main() { string str; cin >> str; if(str.length()==1){ cout << "0" << endl; return 0; } int pos = str.find('0'); if (pos >-1) { str.erase(pos,1); } else { str.erase(0,1); } cout << str << endl; return 0; }
阅读全文
0 0
- Codeforence 258A. Little Elephant and Bits
- 258A. Little Elephant and Bits
- A. Little Elephant and Bits
- A. Little Elephant and Bits
- Codeforces Round #157 (Div. 1)---A. Little Elephant and Bits
- A. Little Elephant and Function
- A. Little Elephant and Chess
- A. Little Elephant and Rozdil
- A. Little Elephant and Problem
- A. Little Elephant and Interval
- <codeforces>A. Little Elephant and Rozdil
- CodeForces 220A Little Elephant and Problem
- codeforces 204A Little Elephant and Interval
- CF:259A. Little Elephant and Chess
- CodeForces 204A Little Elephant and Interval
- CodeForces 204A Little Elephant and Interval
- CF 258B Little Elephant and Elections
- Codeforces-258B Little Elephant and Elections
- python作业第二周
- linux, 使用vprintf,va_list函数封装一个具有printf功能的函数
- 树状数组
- 第五篇:基本数据结构——线性表的链式表示
- ajax同后台交互demo
- 258A. Little Elephant and Bits
- C语言中的变量
- HDU
- 第六篇:基本数据结构——栈的链式表示
- java中含有中文字符的编码和解码
- WEB网页实现微信公众号点赞实现--前端:jquery+bootstrap||后端springmvc+mybatis
- 第七篇:静态链表的游标实现
- ubuntu 16.04 安装 opencv master版本
- Zookeeper C API学习总结