题目链接 https://codeforces.com/contest/1506/problem/A 原题 1506A - Strange Table Example input 5 1 1 1 2 2 3 3 5 11 100 100 7312 1000000 1000000 1000000000000 output 1 2 9 1174 1000000000000 题解 先竖列竖列地排数字, 找到x所在的位置s1; 再横行横行地排, 找到s1位置的值并输出  ----->  (n为总行数,…
Codeforces Round #590 (Div. 3) Editorial 题目链接 官方题解 不要因为走得太远,就忘记为什么出发! Problem A 题目大意:商店有n件商品,每件商品有不同的价格,找出一个最小的可能值price,使得price * n >= sum,sum指的是原来商品价格的总和. 知识点:模拟 思路:求出sum/n向上取整即可,有两种方法.一是使用ceil()函数,但注意ceil()返回的是向上取整后的浮点数,所以要进行强制类型转换:二是直接向下取整,然后用if语句…
题目传送门 /* 水题:读懂题目就能做 */ #include <cstdio> #include <iostream> #include <algorithm> #include <cstring> #include <cmath> #include <vector> #include <string> #include <queue> #include <map> #include <se…
Codeforces Round #747 (Div. 2) A. Consecutive Sum Riddle 思路分析: 一开始想起了那个公式\(l + (l + 1) + - + (r − 1) + r = (l + r)(r - l + 1) / 2\). 然后一看令\(l + r = 1\)最合适,那么就有\(l = r - 1\),一代入就得到\(r = n, l = -n + 1\). 没想通为什么没有一眼看出来. 代码 #include <bits/stdc++.h> #def…
n people are standing on a coordinate axis in points with positive integer coordinates strictly less than 106. For each person we know in which direction (left or right) he is facing, and his maximum speed. You can put a bomb in some point with non-n…
D.Vitya and Strange Lesson(字典树) 题意: 给一个长度为\(n\)的非负整数序列,\(m\)次操作,每次先全局异或\(x\),再查询\(mex\) \(1<=n<=3e5\) \(0<=a_i<=3e5\) \(0<=x<=3e5\) 思路:求\(mex\)可以通过按从高位到低位建字典树,判断左子树是否满,若未满,贪心往走,否则往右走,这样查询是\(log\)的 现在就是异或修改,考虑x的第i位,若为1,则以第i-1层结点为根的左右子树都需要…
http://codeforces.com/contest/1133/problem/Ctime limit per test 2 secondsmemory limit per test 256 megabytesinputstandard inputoutputstandard output You are a coach at your local university. There are $n$ students under your supervision, the programm…
A. Visiting a Friend time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Pig is visiting a friend. Pig's house is located at point 0, and his friend's house is located at point m on an axis. Pi…
被B的0的情况从头卡到尾.导致没看C,心情炸裂又掉分了. A. Pizza Separation time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Students Vasya and Petya are studying at the BSU (Byteland State University). At one of the…
emmm,就ac了3题 A题转换推下公式. tB题模拟,在第一个与最后一个变x后,直接i下标+k,判断当前下标前一个befor与最后一个last距离是否>k,是的话在当前下标往前找*字符然后改为x,这下标更改为befor下标,一直循环判断到i>n. C题找最长公共连续字符子串,因为数据小也可以暴力枚举. D题一开始没推出来,原来只要判断最多的那个数与其他数加起来的大小,大的话相减,小的话判断n的奇偶性.    …