CodeForces - 589D(暴力+模拟)】的更多相关文章

题目链接 题意: 给定一个字符串,最多更改一个字符,问最多可以有多少个“VK”子串? 思路: 由于数据量很小,不妨尝试暴力写.首先算出不更改任何字符的情况下有多个VK字串,然后尝试每一次更改一个位置的字符,然后暴力算出有多少个VK,取出这些答案中 的最大值,即是答案. 代码: #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <c…
Rebranding Problem Description The name of one small but proud corporation consists of n lowercase English letters. The Corporation has decided to try rebranding - an active marketing strategy, that includes a set of measures to change either the bra…
http://www.bnuoj.com/bnuoj/problem_show.php?pid=20832 [题意]: 给你一串字符串,求一个ST(0<ST<=10000),对字符串中字符分别加上(ST-'A'),然后得到的数组分别连起来组成字符串,相邻两个字符相加,取各位数,赋值到下一行,每行讲减少一个字符,直到出现3个字符为100时,输出这时候的ST [题解]: 完全暴力模拟[code]: #include <iostream> #include <stdio.h>…
Counterfeit Dollar Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 35774   Accepted: 11390 Description Sally Jones has a dozen Voyageur silver dollars. However, only eleven of the coins are true silver dollars; one coin is counterfeit ev…
hdu1006 标签(空格分隔): 暴力枚举 好久没有打题了,退队了有好几个月了,从心底不依赖那个人了,原来以为的爱情戏原来都只是我的独角戏.之前的我有时候好希望有个人出现,告诉自己去哪里,做什么,哪种仅仅是渴望被爱的感觉都很美好,大概是因为离开了acm也不再依赖他所以现在我自己告诉自己,自己要去哪里,做什么,突然感觉很踏实,也不那么累了.现在我想把之前没有做好的做好,虽然我已经失去了最好的时机,但还是要在最忙的时间里抽出来做一些曾经有所遗憾的事情. 不多说了,上题! 开始推了半天公式,发现这个…
P2 : Heshen's Account Book Time Limit:1000ms Case Time Limit:1000ms Memory Limit:512MB Description Heshen was an official of the Qing dynasty. He made a fortune which could be comparable to a whole country's wealth by corruption. So he was known as t…
链接:https://www.nowcoder.com/acm/contest/138/D来源:牛客网 小胖参加了人生中最重要的比赛——MedoC资格赛.MedoC的资格赛由m轮构成,使用常见的“加权标准分”的规则.每位选手需要参加所有的m轮的比赛.在一轮中,能取得的分数为自己的成绩除掉最高分的成绩.每个选手的总分为每一轮获得的分数乘上这一轮比赛占得比重.如果在某一轮比赛中所有人获得了零分,那么所有选手在这一轮获得的分数都为0分. 比如说,资格赛一共3轮,三轮的权重分别为30%, 30%, 40…
问题 B: N! 普拉斯 时间限制: 1 Sec  内存限制: 128 MB提交: 114  解决: 35[提交] [状态] [讨论版] [命题人:admin] 题目描述 在处理阶乘时也需要借助计算器. 在计算机中,数字是通过像01像素矩阵来显示的,最终的显示效果如下:  宝儿姐一直在思考一个问题,N!末尾究竟有多少个0?我们假设N!末尾有k个0,请按照规则打印k.  输入 输入一个正整数n(n< 50) ,输入以EOF结尾. 输出 我们假设N!末尾有k个0,请按照规则打印k,数字之间间隔3列0…
问题 A: A + B 普拉斯 在计算机中,数字是通过像01像素矩阵来显示的,最终的显示效果如下:  现在我们用01来构成这些数字 当宝儿姐输入A + B 时(log10(A)<50,log10(B)<50,且A,B均为正整数),你来计算A+B的和C,并按格式在屏幕上打印C. 输入 每组输入包括两个非负整数 A,B(log10(A)<50,log10(B)<50),已EOF结束输入  输出 按格式在屏幕中打印C,数字之间相隔三列0.  样例输入 3 8 样例输出 001000000…
what the fuck! Description 现在有一家公司有nnn个员工(nnn为奇数),他们的工资发放是基本工资+提成,现在这家公司计划再招一批人.要写一篇招聘启事,但是对于这个招聘启事中的薪资具体要写多少犯愁了. 规定招聘启事中薪资为nnn个工人中工资的中位数,为了能更快的招到人,招聘启事中写的薪资越大越好. 现在给出每个人的基本工资,以及可以用来发工资的总钱,你可以自由分配他们的提成(给出的钱可以不用完),让你求出最大的中位数.(保证有答案) Input 第一行两个整数n,sn,…
题目链接:http://codeforces.com/problemset/problem/589/D 题目大意:给出n个人行走的开始时刻,开始时间和结束时间,求每个人分别能跟多少人相遇打招呼(每两人只能打招呼一次). 例: 输入:31 1 105 8 29 9 10 输出: 2 1 1 解题思路:先按行走的开始时刻排下序,然后直接模拟判断和比他后出现的人是否可以相遇. 第一步判断前面那个人在未走完前,下一人会出现,若不出现,直接break.然后就计算当下一个人出现的时刻,前一个人的位置,然后又…
http://codeforces.com/problemset/problem/749/C 题意:有n个人投票,分为 D 和 R 两派,从1~n的顺序投票,轮到某人投票的时候,他可以将对方的一个人KO,被KO的人不能投票了,这样循环,直到某一派的人全部被KO,问哪方赢. 思路:模拟..代码好懂.. #include <cstdio> #include <algorithm> #include <iostream> #include <cstring> #i…
A. Bus to Udayland time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output ZS the Coder and Chris the Baboon are travelling to Udayland! To get there, they have to get on the special IOI bus. The…
A. Games time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Manao works on a sports TV. He's spent much time watching the football games of some country. After a while he began to notice diffe…
A. Crazy Computer time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output ZS the Coder is coding on a crazy computer. If you don't type in a word for a c consecutive seconds, everything you typed…
A. Vasya and Socks time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vasya has n pairs of socks. In the morning of each day Vasya has to put on a pair of socks before he goes to school. When…
#include <bits/stdc++.h> using namespace std; typedef long long ll; ]; ]; int main() { int t; cin>>t; while(t--) { int a,b,c,n; cin>>n>>a>>b>>c; ; i<n; i++) xx[i]=; scanf("%s",x); ,p=,s=; ; i<n; i++) { i…
今天,开博客,,,激动,第一次啊 嗯,,先来发水题纪念一下 D1. Magic Powder - 1   This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you fin…
Fox and Cross Time Limit: 1000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64u Submit Status Description Fox Ciel has a board with n rows and n columns. So, the board consists of n × n cells. Each cell contains either a symbol '.', or a s…
题意是现在有n个雕像把一个圆等分了,每一个雕像有一个吸引力. 叫你不移动雕像只去掉雕像让剩下的雕像还能等分这个圆,求剩下的雕像的吸引力之和的最大值. 显然去掉后剩下雕像的间隔应该是n的因子,因为这样才能使剩下的雕像等分圆. 这道题数据量不大,可以暴力枚举,模拟出每一种情况取最大值就可以了. 现在我们分析完这道题了,写一下步骤. 1.求出n的因子存在list中. ;i <= n/; i++) l.push_back(i); } 2.遍历因子(因子是可以去取的间隔),遍历从1到因子作为第一个取的雕像…
B. Cards time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output Catherine has a deck of n cards, each of which is either red, green, or blue. As long as there are at least two cards left, she can…
Adieu l'ami. Koyomi is helping Oshino, an acquaintance of his, to take care of an open space around the abandoned Eikou Cram School building, Oshino's makeshift residence. The space is represented by a rectangular grid of n × m cells, arranged into n…
Rock... Paper! After Karen have found the deterministic winning (losing?) strategy for rock-paper-scissors, her brother, Koyomi, comes up with a new game as a substitute. The game works as follows. A positive integer n is decided first. Both Koyomi a…
It's hard times now. Today Petya needs to score 100 points on Informatics exam. The tasks seem easy to Petya, but he thinks he lacks time to finish them all, so he asks you to help with one.. There is a glob pattern in the statements (a string consis…
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i. e. points were subtracted). Initially the participant had some score, and each the marks were one by one added…
题意:给你一个01串,问其是否能拆成若干形如0101010的子串,若能,输出所有子串的0,1 的位置. 题解:一开是暴力,然后瞎找规律, 最后找到一种神奇的线性构造法:扫一遍字符串,若为0就一直竖着往下写0,碰到1就回头往上写,再碰到0 就回头往下写······判断无法构造的依据:如果写1写得超过了上界就跳出,如果最后写的0不在最下面也跳出//codeforces上看到的一段代码秀的脑壳疼 坑:之前随便找规律,写了个巨丑的代码,逻辑混乱,直接wa掉. 无脑写的直接T了 ac #define _C…
C. Report time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output Each month Blake gets the report containing main economic indicators of the company "Blake Technologies". There are n commodi…
B. Barnicle time limit per test: 1 second memory limit per test :256 megabytes input: standard input output: standard output Barney is standing in a bar and starring at a pretty girl. He wants to shoot her with his heart arrow but he needs to know th…
传送门:https://codeforces.com/contest/691/problem/F 题意:给你n个数和q次询问,每次询问问你有多少对ai,aj满足ai*aj>=q[i],注意 a*b 与 b*a是不同的 题解:sum[i]记录的是两个数乘积为i的方法数,然后前缀和记录小于等于乘积为i的方法个数,输出答案就容斥一下,因为n个数最多组成n*(n-1)/2对数,减去小于乘积为q[i]的数后即为乘积大于等于q[i]的方法个数 为什么可以暴力是因为注意到了值域的范围为3e6,调和级数的复杂度…
活生生打成了大模拟... #include <bits/stdc++.h> using namespace std; typedef long long LL; typedef unsigned long long ULL; typedef pair<int,int>PII; const double eps=1e-5; const double pi=acos(-1.0); //const int mod=1e9+7; const int INF=0x3f3f3f3f; //ht…