Codeforces 44E - Anfisa the Monkey - [水题]
题目链接:http://codeforces.com/problemset/problem/44/E
题意:
给一个字符串,让你分割成 $k$ 行,每行的字母数在 $[a,b]$ 之间。
题解:
这是1500difficulty的DP题?
AC代码:
#include<bits/stdc++.h>
using namespace std;
int k,a,b;
string s;
int main()
{
cin>>k>>a>>b;
cin>>s; if(s.size()<k*a || k*b<s.size()) cout<<"No solution"<<endl;
else
{
int c=s.size()/k, p=;
for(int r=;r<=k;r++)
{
if(r<k)
{
for(int i=;i<=c;i++) cout<<s[p++];
cout<<endl;
}
else
{
while(p<s.size()) cout<<s[p++];
cout<<endl;
}
}
}
}
Codeforces 44E - Anfisa the Monkey - [水题]的更多相关文章
- codeforces 577B B. Modulo Sum(水题)
题目链接: B. Modulo Sum time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- Codeforces Round #367 (Div. 2)---水题 | dp | 01字典树
A.Beru-taxi 水题:有一个人站在(sx,sy)的位置,有n辆出租车,正向这个人匀速赶来,每个出租车的位置是(xi, yi) 速度是 Vi;求人最少需要等的时间: 单间循环即可: #inclu ...
- codeforces 696A Lorenzo Von Matterhorn 水题
这题一眼看就是水题,map随便计 然后我之所以发这个题解,是因为我用了log2()这个函数判断在哪一层 我只能说我真是太傻逼了,这个函数以前听人说有精度问题,还慢,为了图快用的,没想到被坑惨了,以后尽 ...
- CodeForces 589I Lottery (暴力,水题)
题意:给定 n 和 k,然后是 n 个数,表示1-k的一个值,问你修改最少的数,使得所有的1-k的数目都等于n/k. 析:水题,只要用每个数减去n/k,然后取模,加起来除以2,就ok了. 代码如下: ...
- Codeforces Gym 100286G Giant Screen 水题
Problem G.Giant ScreenTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/con ...
- codeforces 710A A. King Moves(水题)
题目链接: A. King Moves 题意: 给出king的位置,问有几个可移动的位置; 思路: 水题,没有思路; AC代码: #include <iostream> #include ...
- codeforces 659A A. Round House(水题)
题目链接: A. Round House time limit per test 1 second memory limit per test 256 megabytes input standard ...
- CodeForces 489B BerSU Ball (水题 双指针)
B. BerSU Ball time limit per test 1 second memory limit per test 256 megabytes input standard input ...
- codeforces 702A A. Maximum Increase(水题)
题目链接: A. Maximum Increase time limit per test 1 second memory limit per test 256 megabytes input sta ...
随机推荐
- Xcode 常用设置
1.main 文件注释 1)main 文件注释修改路径 /Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/Proje ...
- 如何测试hello world
最近在跟敏捷专家聊到了单元测试的相关内容. 我的问题主要集中在如何推广单元测试. 我们发现在很多团队,开发人员并不是十分愿意去写单元测试,我认为主要的原因是学习写单元测试是有成本的,很多开发同学并不愿 ...
- SNF快速开发平台MVC-单据状态水印
1. 单据状态水印 1.1. 效果展示 1.2. 调用说明 与easyui的调用方式类似,可以在js中调用,也可以在html中写好所有属性,直接渲染. 如下,在html中写好所 ...
- 每日英语:Mrs. Obama Takes Stab at Ping-Pong Diplomacy
U.S. first lady Michelle Obama took ping-pong diplomacy to a new level on Friday on her weeklong tou ...
- linux每日命令(12):nl命令
nl命令在linux系统中用来计算文件中行号.nl 可以将输出的文件内容自动的加上行号!其默认的结果与 cat -n 有点不太一样, nl 可以将行号做比较多的显示设计,包括位数与是否自动补齐 0 等 ...
- GC调优在Spark应用中的实践[转]
作者:仲浩 出处:<程序员>电子刊5月B 摘要:Spark立足内存计算,常常需要在内存中存放大量数据,因此也更依赖JVM的垃圾回收机制.与此同时,它也兼容批处理和流式处理,对于程序 ...
- 【转】Error:JAVA_HOME is not set and could not be found
如果stop-dfs.sh也报了这个错,把$HADOOP_HOME/libexec/hadoop-config.sh中的如下内容之前加上 export JAVA_HOME=/home/lqr/Tool ...
- 导出表结构sql语句
-- C:/dba必需是已经存在的目录 -- create or replace directory UTL_DIR as 'C:\dba'; --用sys用户登录给要访问的用户指定访问目录的权限gr ...
- c++ linux socket编程 c++网络编程
声明:大部分代码来自这篇博客http://www.cnblogs.com/diligenceday/p/6241021.html, 感谢博主 思路: 思路很重要呦~~~ socket详细信息,思路:h ...
- Go指南练习_映射
源地址 https://tour.go-zh.org/moretypes/23 一.题目描述 实现 WordCount.它应当返回一个映射,其中包含字符串 s 中每个“单词”的个数.函数 wc.Tes ...