Codeforces Round #227 (Div. 2) / 387C George and Number (贪心)
Posted synapse7
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Codeforces Round #227 (Div. 2) / 387C George and Number (贪心)相关的知识,希望对你有一定的参考价值。
http://codeforces.com/contest/387/problem/C
/*31ms,100KB*/
#include<cstdio>
char str[100005];
int main()
gets(str);
int i, j, res = 0;
for (i = 0; str[i]; i = j)
for (j = i + 1; str[j] == '0'; j++);
///当出现以下情况时,重置计数:
///右边的数长,或者在长度相等时(这时右边的数必为x000...0的形式),右边的数大
if (j - i > i || j - i == i && str[0] < str[i]) res = 1;
else res++;
printf("%d", res);
return 0;
以上是关于Codeforces Round #227 (Div. 2) / 387C George and Number (贪心)的主要内容,如果未能解决你的问题,请参考以下文章
[ACM]Codeforces Round #534 (Div. 2)
Codeforces Round #726 (Div. 2) B. Bad Boy(贪心)
markdown Serviços - InjeçãodeDependência(DI)+ como usarumeserviçoemum compo