Codeforces 825 A Binary Protocol
来源:互联网 发布:冰川网络下最火的游戏 编辑:程序博客网 时间:2024/06/05 09:54
比赛地址:http://codeforces.com/contest/825/problem/A
题意:数字的每一位是通过多少个1来表明有该位为多少,通过0分隔,0通过0来表示。
思路:直接遍历一遍,如果不理解看代码,代码比较清晰
#include <iostream>#include <cstring>#include <string>#include <queue>#include <vector>#include <map>#include <set>#include <stack>#include <cmath>#include <cstdio>#include <algorithm>#define LL long long #define N 110#define M 50010#define inf 0x3f3f3f3f3f3f3f3fusing namespace std;const LL mod = 1e9 + 7;const double eps = 1e-9;int main() { cin.sync_with_stdio(false); string str; int n; int num; while (cin >> n) { cin >> str; num = 0; for (int i = 0; i < n; i++) { if (str[i] == '1') { num++; } else { cout << num; num = 0; } } cout << num << endl; } return 0;}
阅读全文
0 0
- Codeforces 825 A Binary Protocol
- Educational Codeforces Round 25 A. Binary Protocol
- Educational Codeforces Round 25 A. Binary Protocol
- Binary Protocol (Codeforces
- Educational Codeforces Round 25 A Binary Protocol 基础题
- codeforce round A. Binary Protocol
- Codeforces 830A, Binary Search
- codeforces 838A Binary Blocks
- Paths in a Complete Binary Tree codeforces
- Codeforces 803 A. Maximal Binary Matrix (模拟
- Codeforces 803A Maximal Binary Matrix 题解
- CodeForces 803A Maximal Binary Matrix
- 【暴力】codeforces 838A Binary Blocks
- memcached binary protocol
- memcached binary protocol
- D. Paths in a Complete Binary Tree CodeForces
- 【CodeForces】792D Paths in a Complete Binary Tree
- 【CodeForces 803A】Maximal Binary Matrix(模拟)
- Ubuntu14.04 ROS(indigo) 激光雷达(Sick LMS511) 数据读取
- CUDA编程(八)树状加法
- AS初来乍到Kotlin的配置
- android项目结构设计参考
- B-树、B+树、B*树的区别
- Codeforces 825 A Binary Protocol
- 性能分析神器VisualVM
- 不同的路径 -LintCode
- JAVA (集合和数据结构)
- 百度统计 tongji API 的使用
- linux待了解知识点
- td内容过长table被撑开
- 静态锁和非静态锁
- CUDA编程(九)并行矩阵乘法