题意:

有珍珠和线,问能否重新安排使得相邻珍珠之间的线的数量相等。

思路:

首先,珍珠为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的更多相关文章

  1. Educational Codeforces Round 6 C. Pearls in a Row

    Educational Codeforces Round 6 C. Pearls in a Row 题意:一个3e5范围的序列:要你分成最多数量的子序列,其中子序列必须是只有两个数相同, 其余的数只能 ...

  2. Codeforces Round #480 (Div. 2) A. Links and Pearls

    题目地址:http://codeforces.com/contest/980/problem/A 官方题解: 我的理解:o表示珍珠,-表示链子,给一串字符串你可以任意重组这条项链(不能删去),判断这条 ...

  3. 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 ...

  4. 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 ...

  5. 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 ...

  6. Pearls in a Row CodeForces 620C 水题

    题目:http://codeforces.com/problemset/problem/620/C 文章末有一些测试数据仅供参考 题目大意 给你一个数字串,然后将分成几个部分,要求每个部分中必须有一对 ...

  7. 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 ...

  8. 【32.26%】【codeforces 620C】Pearls in a Row

    time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

  9. codeforces 99999/553 Sultan's Pearls Solution 珍珠 题解

    文章目录 珍珠 题意 分析 增加限定条件 去掉限定条件 Code 珍珠 题意 一共n课珍珠,m颗悬挂,其余在桌子上.如图所示. 仆人每天从某一端"借"一颗珍珠珠.主人每天都会检查悬 ...

随机推荐

  1. 《Redis 垃圾回收》

    推荐一首歌 - <纸短情长> 花粥 很好听 一:redis的垃圾回收 - 为了可以使用更多的内存,redis有一套自己的键值淘汰机制. - 修改 maxmemory参数,限制Redis使用 ...

  2. 新兴的API(fileReader、geolocation、web计时、web worker)

    requestAnimationFrame() 每次浏览器重绘之前会调用这个方法!!! 它接收一个参数,就是回调函数: 它可以保证在最佳的间隔时间调用传入的回调函数,以达到让屏幕产生最流畅的动画效果. ...

  3. 【PyQt5-Qt Designer】PyQt5+eric6 安装和配置

    PyQt5+eric6 安装及配置 1.利用pip命令安装PyQt5 第一步:安装PyQt5 在cmd命令行中输入: pip install PyQt5 第二步:安装Qt的工具包 pip instal ...

  4. oracle中索引快速全扫描和索引全扫描的区别

    当进行index full scan的时候 oracle定位到索引的root block,然后到branch block(如果有的话),再定位到第一个leaf block, 然后根据leaf bloc ...

  5. kvc原理

    KVC底层实现原理 第一步:寻找该属性有没有setsetter方法?有,就直接赋值 第二步:寻找有没有该属性带下划线的成员属性?有,就直接赋值 第三步:寻找有没有该属性的成员属性?有,就直接赋值 1. ...

  6. runtime实现weak属性

    我们可以自己创建一个 A 类,然后在“宿主对象”和“值对象”建立 weak 关系的时候,偷偷地创建一个 A 类的实例 a,绑定在 “值对象” 上. 当“值对象”销毁后,这个 a 也会被销毁.而 A 类 ...

  7. dedecms自定义表单提交成功后提示信息修改和跳转链接修改

    我们在用dedecms自定义表单提交成功后提示信息一般是"Dedecms 提示信息",这个要怎么改成自己想要的文字呢?还有就是提示页停留时间,目前估计就2秒,太快了,要如何设置长点 ...

  8. 20190122 loop

    declare a number; v_begin date := to_date('201901013','yyyymmdd'); v_end date := to_date('20190119', ...

  9. 报错解决——pytesseract.pytesseract.TesseractError: (1,’Error opening data file /usr/local/share/tessdata/eng.traineddata’)

    解决方法:(原文地址http://stackoverflow.com/questions/14800730/tesseract-running-error) $ wget https://tesser ...

  10. what's the python之基本运算符及字符串、列表、元祖、集合、字典的内置方法

    计算机可以进行的运算有很多种,运算按种类可分为算数运算.比较运算.逻辑运算.赋值运算.成员运算.身份运算.字符串和列表的算数运算只能用+和*,字典没有顺序,所以不能进行算数运算和比较运算.比较运算中= ...