codeforces 876 C. Classroom Watch】的更多相关文章

http://codeforces.com/contest/876/problem/C C. Classroom Watch time limit per test 1 second memory limit per test 512 megabytes input standard input output standard output Eighth-grader Vova is on duty today in the class. After classes, he went into…
http://codeforces.com/contest/876/problem/D D. Sorting the Coins time limit per test 1 second memory limit per test 512 megabytes input standard input output standard output Recently, Dima met with Sasha in a philatelic store, and since then they are…
题目链接:http://codeforces.com/contest/876/problem/F 题解:一道简单的思维题,知道最多一共有n*(n+1)/2种组合,不用直接找答案直接用总的组合数减去不符合的也行.找不符合的就简单了.找到一个位置i,他的最左边的位置就是a[i]在二进制下是0的最靠近i的位置,所以可以先用pos[j]记录第j位是0的位置.然后最右边的也是同理.这里还处理一下a[l]=a[r]的情况如果这个相同会出现重复考虑所以可以在第一遍找最左边位置的时候做一下处理最左边的位置起码大…
题目链接:http://codeforces.com/contest/876/problem/D 题解:一道简单的类似模拟的题目.其实就是看右边连出来有多少连续不需要换的假设位置为pos只要找pos-1左边一共有多少x就行(x是什么看一下样例) 第一个是正常解法第二个是用线段树写的,其实正常写就是模拟一下就好 #include<cstdio> #include<cstring> #include<algorithm> #include<cstdlib> #i…
题目链接:http://codeforces.com/problemset/problem/1166/A 思路:统计所有首字母出现的次数,由贪心可知对半分最少. AC代码: #include<iostream> #include<cstdio> #include<string> using namespace std; ]; int n; string a; int main() { cin >> n; ;i < n;i++) { cin >&g…
上场$rating$果然炸飞,但是据说这次只要不$FST$就能翻回来QWQ? T1  $dfs$乱搞? T2  取模乱搞,$STL$ $vector$大法好(%%%$ryf$秒出做法) T3  看了半天,结果竟然是暴力枚举QAQ T4  据说是单调指针,魔改了一番就交了QAQ T5  $ljm$搞了半天,结果连T4都没打,默哀3秒QWQ T6  我搞了个线段树,结果貌似隔壁$wxh$秒了,发现真的是线段树,然后我就不会做了QAQ 我能吐槽$Google$的魔性翻译吗QAQ 让我这种英语渣怎么办啊…
Codeforces Round #441 (Div. 2) codeforces 876 A. Trip For Meal(水题) 题意:R.O.E三点互连,给出任意两点间距离,你在R点,每次只能去相邻点,要走过n个点,求走过的最短距离. #include<cstdio> #include<cstring> #include<algorithm> using namespace std; int main() { int n, a, b, c; scanf("…
http://codeforces.com/contest/876/problem/C 题意: 现在有一个数n,它是由一个数x加上x每一位的数字得到的,现在给出n,要求找出符合条件的每一个x. 思路: n最大1e9,那么9个9最多才加81,所以最多枚举100次,就可以找到所有符合条件的数. 代码: #include <stdio.h> #include <string.h> #include <vector> using namespace std; vector<…
题目链接:http://codeforces.com/contest/876/problem/C 题意: 定义函数:f(x) = x + 十进制下x各位上的数字之和 给你f(x)的值(f(x) <= 1e9),让你输出所有可能的x值. 题解: 部分枚举. 考虑可能的x的范围: ∵ x < f(x) ∴ 十进制下x各位上的数字之和 < 9*9 ≍ 100 所以x枚举[f(x)-100, f(x)]之间的数就好了. AC Code: #include <iostream> #in…
链接:https://codeforces.com/contest/1166/problem/A 题意: There are nn students in the first grade of Nlogonia high school. The principal wishes to split the students into two classrooms (each student must be in exactly one of the classrooms). Two distinc…