题意:

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

思路:

首先,珍珠为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. python之if __name__ == '__main__'

    if __name__ == '__main__' 我们简单的理解就是: 如果模块是被直接运行的,则代码块被运行,如果模块是被导入的,则代码块不被运行.

  2. 重读《深入理解Java虚拟机》一、Java虚拟机内存区域的划分

    一.Java虚拟机内存区域如何划分 1.Java虚拟机内存区域的划分 区域名称 作用(用途) 类型 特点 虚拟机规定异常情况 内存分配与回收 其他说明 1 程序计数器 指示当前正在执行的字节码指令地址 ...

  3. 获取 base64 的封装

    /** * 1. 如何实例化 const fileInput = await FileInput.init(fileInputEle, isMulFile) */ export class FileI ...

  4. sublime phpfmt 的格式化

    php格式化有几种,这里只说phpfmt.这个插件只支持php7.0+,所以在安装php环境应该支持php7.0.至于低版本,在packagecontrol.io对应的插件页面也又提到. 在subli ...

  5. oracle中实现当前月减少或增加N个月

    add_months(last_day(trunc(sysdate)),N)N可以为正,表示增加:N可以为负,表示减少.

  6. spring学习(01)之IOC

    spring学习(01)之IOC IOC:控制反转——Spring通过一种称作控制反转(IOC)的技术促进了低耦合.当应用了IOC,一个对象依赖的其它对象会通过被动的方式传递进来,而不是这个对象自己创 ...

  7. JSON.parseObject 和 JSON.toJSONString

    JSON.parseObject,是将Json字符串转化为相应的对象:JSON.toJSONString则是将对象转化为Json字符串.在前后台的传输过程中,Json字符串是相当常用的,这里就不多介绍 ...

  8. cxPivotGrid导出数据

    导出数据,需要在uses区域引用cxExportPivotGridLink 根据导出类型使用以下过程 procedure cxExportPivotGridToHTML procedure cxExp ...

  9. 在IIS6中FLV不能播放

    故障:Flv文件在本地能播放,上传到服务器上不能播放. 原因:WIN2003加强了IIS6的MIME验证,一切未注册扩展文件格式统统显示404错误. 解决办法:在IIS服务器上添加对.FLV文件的支持 ...

  10. Laravel中路由怎么写(二)

    1.路由命名——给路由起个名字 1.1 基本使用 我们使用as关键字来为路由命名: Route::get('/hello/Laravel',['as'=>'academy',function() ...