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颗悬挂,其余在桌子上.如图所示. 仆人每天从某一端"借"一颗珍珠珠.主人每天都会检查悬 ...
随机推荐
- Appium入门(9)—— Appium API
摘自:http://www.testclass.net/appium/appium-base-api-01/ 1.安装: installApp() driver.installApp("d: ...
- java ipv4校验正则字符串
String IPV4_REGEX = "\\A(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)(\\.(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)) ...
- No module named pip 安装工具提示没有pip模块时,解决办法
python2:cmd命令窗口下执行命令: python -m ensurepipe easy_install pip # 若有权限错误,则在命令前面添加sudosudo easy_install p ...
- bzoj3733 [Pa2013]Iloczyn 搜索
正解:搜索 解题报告: 先放下传送门QwQ umm其实并不难,,,最近在复建基础姿势点所以都写的是些小水题QAQ 首先考虑如果能构造出来一定是因数凑起来鸭,所以先把因数都拆出来,然后就爆搜 几个常见的 ...
- java版迷宫
当年学数据结构,正好java也刚刚学会gui编程,就想着结合起来做个小东西,然后这个自动走路的小球就出来了. 一个方向的枚举Dir.java public enum Dir { L,U,R,D } 结 ...
- 什么是url?
什么是URL? URL是统一资源定位器(Uniform Resource Locator)的缩写,也被称为网页地址,是因特网上标准的资源的地址. URL举例 http://www.sohu.com/s ...
- RN picker使用
这里是只有苹果的,如果想适配andorid,可以在showPickerFun方法里面使用platefrom判断 代码: import React, {Component} from 'react'; ...
- studio-3t-x64 下载地址
https://download.studio3t.com/studio-3t/windows/2018.4.6/studio-3t-x64.zip Studio 3T 破解教程1.创建文件studi ...
- vue/cli 3.0 font-size随屏幕大小变化而变化 rem设置
在安装cube-ui框架时 安装成功后在[E:\WWW\xxx\node_modules\vue-cli-plugin-cube-ui\generator\rem\index.js]修改remUnit ...
- sqlserver把数据导入mysql
sqlserver库 navicat逆向表到模型 转换模型为... 选择mysql 建模转换后导出sql 导出sql后,再mysql库中执行该sql(该sql为表结构)执行sql后,使用navicat ...