cf#512 C. Vasya and Golden Ticket
题目链接 http://codeforces.com/contest/1058/problem/C
这题还是暴力最方便,和的情况最多有n*a[i] 900种把每种都试一遍
#include<bits/stdc++.h>
using namespace std;
int n;
string s;
bool check(int x)
{ int sum=,cnt=;
for(int i=;i<n;i++)
{
sum+=(s[i]-'');
if(sum==x)
{ sum=;cnt++;
}
else if(sum>x)
{ return false;
}
}
if(sum!=)return false;
if(cnt>=)return true;
else return false;
}
int main()
{
cin>>n>>s;
int num=n*;
for(int i=;i<=num;i++)
{
if(check(i))
{
cout<<"YES"<<endl;
return ;
}
}
cout<<"NO"<<endl;
return ;
}
cf#512 C. Vasya and Golden Ticket的更多相关文章
- Codeforces Round #512 (Div. 2, based on Technocup 2019 Elimination Round 1) C. Vasya and Golden Ticket 【。。。】
任意门:http://codeforces.com/contest/1058/problem/C C. Vasya and Golden Ticket time limit per test 1 se ...
- CodeForces 1058C C. Vasya and Golden Ticket
C. Vasya and Golden Ticket time limit per test1 second memory limit per test256 megabytes inputstand ...
- 【codeforces1058】Vasya and Golden Ticket 枚举+暴力+模拟
#点击传送 题目描述 Recently Vasya found a golden ticket - a sequence which consists of nn digits a1a2-ana1a2 ...
- Codeforces Round #512 D - Vasya and Triangle
D - Vasya and Triangle #include<bits/stdc++.h> using namespace std; #define LL long long LL gc ...
- 黄金票据(Golden Ticket)的原理与实践
0.黄金票据是什么? 在与认证过程中,经过client与AS的通信会得到TGT,带着TGT想TGS请求,得到票据ticket,用这个ticket可以来访问应用服务器.如果这段有什么疑问,欢迎参考Ker ...
- CF 1107 E. Vasya and Binary String
E. Vasya and Binary String 链接 分析: 对于长度为x的一段序列,我们可以dp出消除的过程的最优方案,背包即可. 然后区间dp,可以先合并完所有的点,即没相同的一段区间合并为 ...
- CF 1042 E. Vasya and Magic Matrix
E. Vasya and Magic Matrix http://codeforces.com/contest/1042/problem/E 题意: 一个n*m的矩阵,每个位置有一个元素,给定一个起点 ...
- CF Edu54 E. Vasya and a Tree DFS+树状数组
Vasya and a Tree 题意: 给定一棵树,对树有3e5的操作,每次操作为,把树上某个节点的不超过d的子节点都加上值x; 思路: 多开一个vector记录每个点上的操作.dfs这颗树,同时以 ...
- Codeforces Round #512 E - Vasya and Good Sequences
有时候觉得自己就是个思路搬运机,只会搬运思路 这个题首先说了求的是好区间的个数, 好区间满足条件: 1.二进制位1的数量和为偶数 2.w[i]表示a[i]的二进制上1的个数 ,sum[i] = ...
随机推荐
- php 日志扩展
今天发现一个比较好的php应用日志扩展,这里先mark一下,回头有空再详细介绍: http://neeke.github.io/SeasLog/
- wampserver 最新版本 mysql修改数据库密码
由于wampsever版本更新就导致以前版本的密码修改造成失败,主要是密码字段改变造成的! 第一步 进入MySQL 控制台 wamp安装,数据库是没有密码 进入控制台直接回车就可以了 第二步 使用 ...
- 获取Windows安装日期
- 20145238-荆玉茗《网络对抗技术》-Web基础
20145238荆玉茗-<网络攻防>-Wbe基础 实践过程记录 实践过程记录 一.Apache 1.环境配置 使用apachectl start开启Apach,使用netstat -apt ...
- [转]C#打造一个开源webgis(一)系统架构
搭建一个GIS系统,为了能同时适应C/S和B/S架构,建议是做成自己的地图服务api方式,这样,一个或多个系统,就能通过统一的地图服务接口提供,而通信可以采用http的resful方式,而一个webG ...
- hdu 1021 Fibonacci Again(变形的斐波那契)
传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1021 Fibonacci Again Time Limit: 2000/1000 MS (Java/Ot ...
- 设置UI控件的Layer属性(边框可见,边框颜色,边框宽度,边框圆角)
设置UI控件的Layer属性 #import "ViewController.h" @interface ViewController () @property (strong, ...
- PCB 布线 注意哪些问题记录
1.过孔不能打在焊盘上 ,这样 焊接的时候 会有焊锡 溢出导致 短路. 2.焊盘的线引出时应该从中间引出,不应该从角落引出 3.当有较粗的电源线连接在元器件上时,最好是 有一根小线连接在元器件上,回流 ...
- 用HTML编写迪士尼乐园页面
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/html"><head lang="e ...
- 异常笔记:运行hdfs copyFromLocal 上传文件报错
把本地文件系统,复制到dfs文件系统时报错的错 [hadoop@localhost ~]$ hdfs dfs -copyFromLocal /home/hadoop/mk.txt /xg_test/ ...