题目传送门

 /*
贪心水题:首先,最少的个数为n最大的一位数字mx,因为需要用1累加得到mx,
接下来mx次循环,若是0,输出0;若是1,输出1,s[j]--;
注意:之前的0的要忽略
*/
#include <cstdio>
#include <iostream>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
using namespace std; const int MAXN = 1e4 + ;
const int INF = 0x3f3f3f3f; int main(void) //Codeforces Round #300 A Cutting Banner
{
//freopen ("B.in", "r", stdin); char s[];
while (scanf ("%s", &s) == )
{
int len = strlen (s);
int mx = -;
for (int i=; i<len; ++i) mx = max (mx, s[i] - ''); printf ("%d\n", mx);
for (int i=; i<=mx; ++i)
{
bool ok = false;
for (int j=; j<len; ++j)
{
if (s[j] == '')
{
if (!ok) continue;
else printf ("");
}
else
{
ok = true;
printf (""); s[j]--;
}
}
if (i < mx) printf (" ");
}
puts ("");
} return ;
}

贪心 Codeforces Round #300 A Cutting Banner的更多相关文章

  1. 水题 Codeforces Round #300 A Cutting Banner

    题目传送门 /* 水题:一开始看错题意,以为是任意切割,DFS来做:结果只是在中间切出一段来 判断是否余下的是 "CODEFORCES" :) */ #include <cs ...

  2. Codeforces Round #300 A. Cutting Banner 水题

    A. Cutting Banner Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/538/pro ...

  3. Codeforces Round #300(A.【字符串,多方法】,B.【思维题】,C.【贪心,数学】)

    A. Cutting Banner time limit per test:2 seconds memory limit per test:256 megabytes input:standard i ...

  4. Codeforces Round #300 解题报告

    呜呜周日的时候手感一直很好 代码一般都是一遍过编译一遍过样例 做CF的时候前三题也都是一遍过Pretest没想着去检查... 期间姐姐提醒说有Announcement也自信不去看 呜呜然后就FST了 ...

  5. Codeforces Round #300(Div. 2)-538A.str.substr 538B.不会 538C.不会 。。。

    A. Cutting Banner time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...

  6. 贪心 Codeforces Round #288 (Div. 2) B. Anton and currency you all know

    题目传送门 /* 题意:从前面找一个数字和末尾数字调换使得变成偶数且为最大 贪心:考虑两种情况:1. 有偶数且比末尾数字大(flag标记):2. 有偶数但都比末尾数字小(x位置标记) 仿照别人写的,再 ...

  7. 贪心 Codeforces Round #301 (Div. 2) B. School Marks

    题目传送门 /* 贪心:首先要注意,y是中位数的要求:先把其他的都设置为1,那么最多有(n-1)/2个比y小的,cnt记录比y小的个数 num1是输出的1的个数,numy是除此之外的数都为y,此时的n ...

  8. 贪心 Codeforces Round #297 (Div. 2) C. Ilya and Sticks

    题目传送门 /* 题意:给n个棍子,组成的矩形面积和最大,每根棍子可以-1 贪心:排序后,相邻的进行比较,若可以读入x[p++],然后两两相乘相加就可以了 */ #include <cstdio ...

  9. 贪心 Codeforces Round #304 (Div. 2) B. Soldier and Badges

    题目传送门 /* 题意:问最少增加多少值使变成递增序列 贪心:排序后,每一个值改为前一个值+1,有可能a[i-1] = a[i] + 1,所以要 >= */ #include <cstdi ...

随机推荐

  1. [Effective JavaScript 笔记]第30条:理解prototype、getPrototypeOf和__ptoto__之间的不同

    原型包括三个独立但相关的访问器.这三个单词都是对单词prototype做了一些变化. C.prototype用于建立由new C()创建的对象的原型 Object.getPrototypeOf(obj ...

  2. HDU 1506 Largest Rectangle in a Histogram (dp左右处理边界的矩形问题)

    E - Largest Rectangle in a Histogram Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format: ...

  3. lucas定理,组合数学问题

    对于C(n, m) mod p.这里的n,m,p(p为素数)都很大的情况.就不能再用C(n, m) = C(n - 1,m) + C(n - 1, m - 1)的公式递推了. 这里用到Lusac定理 ...

  4. 数学复习 ---- Mathematics Notes: A Programmer's Perspective ---- by Orzer ---- 我是沙茶

    今年是好没长进的一年呢..只学了些基本的方法.. 本文记号0] x:p x类型为p1] f(x) 表示一个函数2] (n_1,n_2,...) 表示多元组,特别的,(n)表示一个一元组3] x 表示一 ...

  5. emu1

    第一题 一个很奇怪的贪心.先排序一遍,再扫描一遍,能加入尽量加入,不能加入就一定不能加入..由于每次都在可能的最早时间加入一个数可以保证差最小?反正差不多这样了. O(n log n) #includ ...

  6. net发送邮件

    对于.NET而言,从2.0开始,发邮件已经是一件非常easy 的事了.下面我给出一个用C#群发邮件的实例,做了比较详细的注解,希望对有需要的朋友有所help.看了这篇BLOG,如果你还不会用.NET发 ...

  7. 15.含有指针成员的类的拷贝[ClassCopyConstructorWithPointerMember]

    [题目] 下面是一个数组类的声明与实现.请分析这个类有什么问题,并针对存在的问题提出几种解决方案.  C++ Code  123456789101112131415161718192021222324 ...

  8. php 字符串负值判断

    2014年9月9日 11:54:54 $a = '-1'; $b = (int)$a; $c = is_numeric($a); if ($a) { echo 1; //echo 1 } else { ...

  9. eclipse连接虚拟机

    1.启动eclipse 2.打开 "Help/Install New Software..." 3.打开Add…… 4.输入Name: Genymobile          Lo ...

  10. 低配置电脑播放 flash 视频时 占 cpu 资源过高的解决方法

    安装低版本的 flash player 版本, 经调试能满足播放的最低版本是 Flash Player 10.3.183.90 然后 firefox 3.6.28 + Adblock Plus 2.0 ...