Educational Codeforces F. Remainder Problem】的更多相关文章

[传送门] 题意就是单点加以及查询下标为等差数列位置上的值之和.刚开始看到这道题.我以为一个数的倍数是log级别的.就直接写了发暴力.就T了.还在想为啥,优化了几发才发现不太对劲.然后才想到是$\dfrac {n}{x}$级别的.不过看到$\dfrac {n}{x}$应该就出来了.当$x \leq \sqrt n$时用$sum[i][j]$表示公差为$i$,首项为$j$的和.修改时可以$O(\sqrt n)$修改,查询就可以$O(1)$了.当$x > \sqrt n$时直接暴力就行了. #inc…
Digital collectible card games have become very popular recently. So Vova decided to try one of these. Vova has n cards in his collection. Each of these cards is characterised by its power pi, magic number ci and level li. Vova wants to build a deck…
After several latest reforms many tourists are planning to visit Berland, and Berland people understood that it's an opportunity to earn money and changed their jobs to attract tourists. Petya, for example, left the IT corporation he had been working…
Vasya has an array a consisting of positive integer numbers. Vasya wants to divide this array into two non-empty consecutive parts (the prefix and the suffix) so that the sum of all elements in the first part equals to the sum of elements in the seco…
Problem A Lucky Year 题目传送门[here] 题目大意是说,只有一个数字非零的数是幸运的,给出一个数,求下一个幸运的数是多少. 这个幸运的数不是最高位的数字都是零,于是只跟最高位有关,只保留最高位,然后加一求差就是答案. Code /** * Codeforces * Problem#808A * Accepted * Time:15ms * Memory:0k */ #include<iostream> #include<cstdio> #include<…
1) Link to the problem: http://codeforces.com/contest/888/problem/C 2) Description: You are given a string s consisting of lowercase Latin letters. Character c is called k-dominant if each substring of s with length at least k contains this character…
You are given two integers n and k. Find k-th smallest divisor of n, or report that it doesn't exist. Divisor of n is any such natural number, that n can be divided by it without remainder. Input The first line contains two integers n and k (1 ≤ n ≤ …
传送门 A.There Are Two Types Of Burgers 签到. B.Square Filling 签到 C.Gas Pipeline 每个位置只有"高.低"两种状态,所以直接根据条件来\(dp\)即可. Code #include <bits/stdc++.h> #define MP make_pair #define INF 0x3f3f3f3f3f3f3f3f using namespace std; typedef long long ll; con…
https://www.cnblogs.com/31415926535x/p/11460682.html 上午没课,做一套题,,练一下手感和思维,,教育场的71 ,,前两到没啥,,后面就做的磕磕巴巴的,,,有想法但是不敢实现,,自我否定,,没了思路就只能官方题解,,发现其实都很简单,,,思维场把,,,, A There Are Two Types Of Burgers 贪心就完事了,,推出公式不知道怎么证明是最优的,,,(敲错变量还wale一发emmm #include <bits/stdc++…
A. There Are Two Types Of Burgers 题意: 给一些面包,鸡肉,牛肉,你可以做成鸡肉汉堡或者牛肉汉堡并卖掉 一个鸡肉汉堡需要两个面包和一个鸡肉,牛肉汉堡需要两个面包和一个牛肉 求能得到的最多的钱 直接贪心,哪个比较贵就选哪个做,剩下的材料再做另一个 #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #include<cmath…