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颗悬挂,其余在桌子上.如图所示. 仆人每天从某一端"借"一颗珍珠珠.主人每天都会检查悬 ...
随机推荐
- 《HTTP - 理解 Content-Type》
一:引言 在此之前先看一个小例子:(html 上传文件,服务端为PHP) <?php var_dump($_FILES);?> <!DOCTYPE html> <html ...
- MIPS 指令集开源了
去年年底我们报导过 MIPS 指令集将于今年第一季度开源的消息,现在 MIPS 官方已经正式将其释出. MIPS 是一种精简指令集(Reduced Instruction Set Computer,R ...
- 第 7 章 Data 类型
目录 第 7 章 Data 类型 一.创建方式 二.转时间戳 其他 第 7 章 Data 类型 @(es5) 参考了: 阮一峰javascript的标准.<javascript高级教程> ...
- 怎么使用JavaScript进行进制转换
JS 是一个很神奇的语言,内制的的很多函数可以帮我们进行数(进)制转换: JS中可以直接使用16进制: var a = 0xff; //255 将任意进制字符串转换为十进制,如二进制,八进制,十六进制 ...
- SpringBoot-整合多数据源
整合多数据源 这里有两种,分包数据源和注解数据源,这里讲分包数据源 配置文件中新增两个数据源 spring.datasource.test1.driverClassName = com.mysql.j ...
- caz,数字证书,公钥
如何有效检查证书有效性? https://www.jianshu.com/p/f4a37da10c53 自签名的https证书是不安全的 https://www.cnblogs.com/liyy201 ...
- c# 文件或者文件夹改名的最简单方法
使用cmd命令 ren Process.Start( "cmd", "/C " + "ren f:\\first c code.txt zhou.tx ...
- Scala的apply unapply unapplySeq 语法糖
apply 可以理解为注入 unapply unapplySeq 可以理解为提取 apply 与 unapply 虽然名字相近,但是使用起来区别挺大.apply有点像构造函数unapply主要是结合模 ...
- [django]梳理drf知识点2
外键关系的自动维护 原始提交的server数据 { ... "manufacturer": "DELL", "model_name": &q ...
- 继承时,当父子类都具有相同的成员变量,默认情况下是直接调用子类的成员变量,当要调用父类的成员变量则需要使用super关键之
package day02; public class Person { String name="fl"; }class Car{ }class Student extends ...