本来准备好好打一场的,然而无奈腹痛只能带星号参加 (我才不是怕被打爆呢!) PROBLEM C - Star sky 题 OvO http://codeforces.com/contest/835/problem/C 835C 解 由于题目中给的c很小,可以对应每种亮度分别保存(c+1)个矩阵 然后初始化一下求前缀矩阵 每次询问就可以O(c)求出答案 (Accepted) #include <iostream> #include <cstring> #include <cst…
C. Star sky time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Problem Description The Cartesian coordinate system is set in the sky. There you can see n stars, the i-th has coordinates (xi, yi),…
题目链接就长这样子? time limit per test 2 seconds memory limit per test 256 megabytes   Description The Cartesian coordinate system is set in the sky. There you can see n stars, the i-th has coordinates (xi, yi), a maximum brightness c, equal for all stars, a…
s <= c是最骚的,数组在那一维开了10,第八组样例直接爆了- - /* CodeForces 835C - Star sky [ 前缀和,容斥 ] | Codeforces Round #427 (Div. 2) 题意: 有一片 100*100 的星空,上面有 n 颗星星,每个星星有一个亮度,且在 0~C 范围内周期性变化,现在给出 q 个查询,每个查询给出时间和一个矩形,求在该时间时矩形内星星的亮度和. c <= 10 分析: 由于 c <= 10,则星星的亮度只有11种情况,全部…
证明在Tutorial的评论版里 /* CodeForces 835D - Palindromic characteristics [ 分析,DP ] | Codeforces Round #427 (Div. 2) 题意: 定义 k 回文串满足: 1. 左右子串相等 2. 左右子串为k-1回文串 1 回文串 就是回文串 问你字符串s的子串的每阶回文子串的数目 分析: 研究一下可以发现 k 回文串的要求等价于 1. 本身是回文串 2. 左右子串是k-1回文串 然后可以dp了,还有一个结论是: 若…
A. Key races 题目链接:http://codeforces.com/contest/835/problem/A 题目意思:两个比赛打字,每个人有两个参数v和t,v秒表示他打每个字需要多久时间,等这个这个字传递过去需要t秒,而且在打第一个字之前也会有一个反应时间t.问第一个人可不可以获胜. 题目思路:这个题目当时题目没读懂,明白之后就是一个非常简单的题目了. (s*v1+2*t1)<(s*v2+2*t2)第一个人就可以获胜 (s*v1+2*t1)==(s*v2+2*t2) 就会平局,否…
B. The number on the board 题意: 有一个数字,它的每个数位上的数字的和不小于等于k.现在他改变了若干位,变成了一个新的数n,问现在的数和原来的数最多有多少位不同. 思路: 如果现在的数字各位数字之和大于等于k,那么它就可能没有被改变. 反之,那么每个数的最大改变量就是9减去这个数,于是把9减去每个数得到的结果从大到小排序,用k减去现在的数位和得到的结果记为kk,遍历一遍差量数组,用kk去减,知道kk小于0跳出. 代码: #include <stdio.h> #inc…
Palindromic characteristics of string s with length |s| is a sequence of |s| integers, where k-th number is the total number of non-empty substrings of s which are k-palindromes. A string is 1-palindrome if and only if it reads the same backward as f…
The Cartesian coordinate system is set in the sky. There you can see n stars, the i-th has coordinates (xi, yi), a maximum brightness c, equal for all stars, and an initial brightness si (0 ≤ si ≤ c). Over time the stars twinkle. At moment 0 the i-th…
[Link]:http://codeforces.com/contest/835/problem/C [Description] 给你n个星星的坐标(xi,yi); 第i个星星在第t秒,闪烁值变为(si+t)%(c+1); 给你q个询问,每个询问由时间t和一个矩形的左下角和右上角组成; 问这个矩形区域内的星星闪烁值的总和; [Solution] 朴素的做法; a[j][k][l]表示(j,k)这个点一开始闪烁值为l的星星有多少个; for (int i = 1;i <= q;i++){ int…
Two boys decided to compete in text typing on the site "Key races". During the competition, they have to type a text consisting of s characters. The first participant types one character in v1 milliseconds and has ping t1 milliseconds. The secon…
引子: A题过于简单导致不敢提交,拖拖拉拉10多分钟还是决定交,太冲动交错了CE一发,我就知道又要错过一次涨分的机会.... B题还是过了,根据题意目测数组大小开1e5,居然蒙对,感觉用vector更好一点... C题WA第9组,GG思密达....明天起床再补C吧 - - 题目链接: http://codeforces.com/contest/835/problem/B B. The number on the board Some natural number was written on t…
http://codeforces.com/contest/835 A.拼英语水平和手速的签到题 #include <bits/stdc++.h> using namespace std; int s, v1, v2, t1, t2; int main() { cin >> s >> v1 >> v2 >> t1 >> t2; int a1 = t1 + v1 * s + t1; int a2 = t2 + v2 * s + t2;…
[Link]:http://codeforces.com/contest/835/problem/D [Description] 给你一个字符串; 让你在其中找到1..k阶的回文子串; 并统计它们的数量 如果一个字符串是一个回文串,则它可以是1阶子串; k阶字符串,要求它的左边和右边都是k-1阶子串; [Solution] bo[i][j]表示i..j这一段是否为回文; 可以用O(n2)的复杂度处理出整个bo数组; 然后O(n2)枚举每一段区间; 算出这个区间的字符串最大可以是一个几阶字符串记为…
[Link]:http://codeforces.com/contest/835/problem/A [Description] [Solution] 傻逼题. [NumberOf WA] [Reviw] [Code] #include <bits/stdc++.h> using namespace std; #define int long long int n,v1,v2,t1,t2; main(){ scanf("%lld%lld%lld%lld%lld",&…
[Link]:http://codeforces.com/contest/835 [Description] 原本有一个数字x,它的各个数码的和原本是>=k的; 现在这个数字x,在不改变位数的情况下,变成了n; 问你n和原来的数字x最少可能有多少位不一样. (x是未知的) [Solution] 如果各位大于等于k,直接输出0; 否则,先把n小的数码加到9; 一直加知道大于等于k; [NumberOf WA] 0 [Reviw] [Code] #include <bits/stdc++.h>…
题目链接:http://codeforces.com/contest/835/problem/D 题意:给定一个字符串,定义kth回文是左半部分等于右半部分,并且左半部分和右半部分都是(k-1)th回文. 只要是回文字串都是1th回文. 对于1<=k<=strlen(s),输出kth回文的数量. 思路:预处理出每个子串是否是回文.然后len^2枚举区间,如果s[i][j]是回文的话,继续枚举左半部分s[i][i+(j-i+1)/2-1]是否是回文,是的话再继续枚举左半部分然后顺便统计答案即可.…
题目链接:http://codeforces.com/contest/835/problem/C 题意:在二维坐标里,有n个星星,m个询问,星星的最大亮度c.然后输入n个星星的坐标和初始亮度,对于每个询问你需要回答对于左下角(x1,y1)和右上角(x2,y2)的矩形区域中的星星中,经过t秒后亮度和是多少?    对于一个星星如果在第t秒亮度为x,那么在t+1秒亮度将变成x+1(x+1<=c时)或0(x+1>c). 思路:由于c<=10.所以对于一个矩形区域只需要统计初始每个亮度出现的数量…
题目链接:http://codeforces.com/contest/835/problem/B 题意:给定一个数k和一个数字串n.问你最少改几个数字才能满足所有数字的和不小于k. 思路:考虑贪心,每次肯定把最小的数字改成'9' 会使得所有数字的和最大. #define _CRT_SECURE_NO_DEPRECATE #include<iostream> #include<cstdio> #include<cstring> #include<algorithm&…
题目链接:http://codeforces.com/contest/835/problem/A 题意:两个人给网站发信息,现在给出信息的长度n,两个人的延迟和打字速度(一个字符),问网站先收到哪个人的信息或者同时收到(平局).对于每个人的流程是:先进行一次延迟,然后开始输入信息,最后再进行一个延迟后网站收到该人所发的信息. 思路:水题. 按照题意求出两人的所花时间即可 #define _CRT_SECURE_NO_DEPRECATE #include<iostream> #include&l…
本题是个简单的区间dp 最近都没时间做题了,被我妈强制喊回去,然后颓废了10天(回家也没发控制住自己= = 我的锅),计划都打乱了,本来还报名了百度之星,然后没时间参加 #include<cmath> #include<map> #include<iostream> #include<cstring> #include<cstdio> #include<set> #include<vector> #include<q…
Some natural number was written on the board. Its sum of digits was not less than k. But you were distracted a bit, and someone changed this number to n, replacing some digits with others. It's known that the length of the number didn't change. You h…
D. Palindromic characteristics time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output Palindromic characteristics of string s with length |s| is a sequence of |s| integers, where k-th number is t…
E. The penguin's game time limit per test: 1 second memory limit per test: 256 megabytes input: standard input output: standard output Pay attention: this problem is interactive. Penguin Xoriy came up with a new game recently. He has n icicles number…
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate it n = int(raw_input()) s = "" a = ["I hate that ","I love that ", "I hate it","I love it"] for i in ran…
Codeforces Round #354 (Div. 2) Problems     # Name     A Nicholas and Permutation standard input/output 1 s, 256 MB    x3384 B Pyramid of Glasses standard input/output 1 s, 256 MB    x1462 C Vasya and String standard input/output 1 s, 256 MB    x1393…
直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输出”#Color”,如果只有”G”,”B”,”W”就输出”#Black&White”. #include <cstdio> #include <cstring> using namespace std; const int maxn = 200; const int INF =…
 cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅.....       其实这个应该是昨天就写完的,不过没时间了,就留到了今天.. 地址:http://codeforces.com/contest/651/problem/A A. Joysticks time limit per test 1 second memory limit per test 256…
Codeforces Round #279 (Div. 2) 做得我都变绿了! Problems     # Name     A Team Olympiad standard input/output 1 s, 256 MB  x2377 B Queue standard input/output 2 s, 256 MB  x1250 C Hacking Cypher standard input/output 1 s, 256 MB  x740 D Chocolate standard in…
Codeforces Round #262 (Div. 2) 1003 C. Present time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Little beaver is a beginner programmer, so informatics is his favorite subject. Soon his info…