codeforces 980A Links and Pearls
题意:
有珍珠和线,问能否重新安排使得相邻珍珠之间的线的数量相等。
思路:
首先,珍珠为0或者线为0,那么都满足条件;
其次,如果珍珠的个数大于线的个数,那么肯定不满足条件;
然后,如果线的个数能够被珍珠整除,那么满足条件,否则不满足。
代码:
#include <iostream>
#include <string>
#include <stdio.h>
using namespace std;
int main()
{
string s;
cin >> s;
int l = ,p = ;
for (int i = ;i < s.size();i++)
{
if (s[i] == 'o') p++;
else l++;
}
if (l == || p == ) puts("Yes");
else
{
if (p > l) puts("no");
else if (l % p == ) puts("yes");
else puts("no");
}
return ;
}
codeforces 980A Links and Pearls的更多相关文章
- Educational Codeforces Round 6 C. Pearls in a Row
Educational Codeforces Round 6 C. Pearls in a Row 题意:一个3e5范围的序列:要你分成最多数量的子序列,其中子序列必须是只有两个数相同, 其余的数只能 ...
- Codeforces Round #480 (Div. 2) A. Links and Pearls
题目地址:http://codeforces.com/contest/980/problem/A 官方题解: 我的理解:o表示珍珠,-表示链子,给一串字符串你可以任意重组这条项链(不能删去),判断这条 ...
- Codeforces 620C EDU C.Pearls in a Row ( set + greed )
C. Pearls in a Row There are n pearls in a row. Let's enumerate them with integers from 1 to n from ...
- Educational Codeforces Round 6 C. Pearls in a Row set
C. Pearls in a Row There are n pearls in a row. Let's enumerate them with integers from 1 to n from ...
- CodeForces - 620C Pearls in a Row 贪心 STL
C. Pearls in a Row time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- Pearls in a Row CodeForces 620C 水题
题目:http://codeforces.com/problemset/problem/620/C 文章末有一些测试数据仅供参考 题目大意 给你一个数字串,然后将分成几个部分,要求每个部分中必须有一对 ...
- codeforces C. Pearls in a Row map的应用
C. Pearls in a Row time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- 【32.26%】【codeforces 620C】Pearls in a Row
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...
- codeforces 99999/553 Sultan's Pearls Solution 珍珠 题解
文章目录 珍珠 题意 分析 增加限定条件 去掉限定条件 Code 珍珠 题意 一共n课珍珠,m颗悬挂,其余在桌子上.如图所示. 仆人每天从某一端"借"一颗珍珠珠.主人每天都会检查悬 ...
随机推荐
- webpack打包配置模板
/** * Created by zzq on 2017/3/26. *///__dirname是node.js中的一个全局变量,它指向当前执行脚本所在的目录module.exports = {//注 ...
- mysql分库 分表
原文链接:http://www.jianshu.com/p/89311703b320 传统的分库分表传统的分库分表都是通过应用层逻辑实现的,对于数据库层面来说,都是普通的表和库.分库分库的原因 首先, ...
- ansible源码安装
一.升级python 笔者系统为centos6.5,系统默认安装python2.6,虽然ansible官方文档要求python版本为2.6或2.7,然而许多人都说使用2.6可能出现一系列问题,所以作者 ...
- sql server 复制常见问题及查看
1.SQL Server同步复制问题排查方法http://blog.csdn.net/roy_88/article/details/41481059 2.[同步复制常见错误处理1]当IDENTITY_ ...
- redis缓存和mysql数据库同步
附redis关于缓存雪崩和缓存穿透,热点key 穿透 穿透:频繁查询一个不存在的数据,由于缓存不命中,每次都要查询持久层.从而失去缓存的意义. 解决办法: 持久层查询不到就缓存空结果,查询时先判断缓存 ...
- 我的DIY作品
工欲善其事必先利其器~呵呵~我自己体会从无到有的乐趣~0~ 从Visio到CAD再到Autodesk,你妹的~只有自己才懂~哎~感谢兄弟朋友们的支持! Visio图: CAD图: Autodesk图:
- 20165236 第六周Java学习总结
20165236 第六周Java学习总结 一. 第八章内容: 1.String 类: String对象.常量对象:字符串并置: 常用方法: length,equals,startsWith,compa ...
- 前端框架之Vue(1)-第一个Vue实例
vue官方文档 知识储备 es6语法补充 let 使用 var 声明的变量的作用域是全局. { var a = 1; } console.info(a); 例1: var arr = []; for ...
- vue-自定义全局键盘码
1.Vue.config.keyCodes.enter=13; //main.js中定义全局 <template> <div> <input v-model=" ...
- [django]django models最佳实战
models class People(models.Model): name = models.CharField(max_length=30) age = models.CharField(max ...