Problem Description The aspiring Roy the Robber has seen a lot of American movies, and knows that the bad guys usually gets caught in the end, often because they become too greedy. He has decided to work in the lucrative business of bank robbery only…
Problem V | limit 4 secondsGearsA set of gears is installed on the plane. You are given the center coordinate and radius of eachgear. For a given input and output gear, indicate what happens to the output gear if you attemptto rotate the input gear.I…
ID Origin Title 111 / 423 Problem A LightOJ 1370 Bi-shoe and Phi-shoe 21 / 74 Problem B LightOJ 1356 Prime Independence 61 / 332 Problem C LightOJ 1341 Aladdin and the Flying Carpet 54 / 82 Problem D LightOJ 1336 Sigma Function 66 /…
Maximum GCD https://vjudge.net/contest/288520#problem/V Given the N integers, you have to find the maximum GCD (greatest common divisor) of every possible pair of these integers. Input The first line of input is an integer N (1 < N < 100) that deter…
题目:Problem A. Arithmetic DerivativeInput file: standard inputOutput file: standard inputTime limit: 1 secondMemory limit: 256 mebibytesLets define an arithmetic derivative:• if p = 1 then p0 = 0;• if p is prime then p0 = 1;• if p is not prime then n0…
题目: Problem D. Great AgainInput file: standard inputOutput file: standard outputTime limit: 2 secondsMemory limit: 512 megabytesThe election in Berland is coming. The party United Berland is going to use its influence to win themagain. The crucial co…
题目:Problem K. PiecemakingInput file: standard inputOutput file: standard outputTime limit: 1 secondMemory limit: 512 mebibytesThe civil war in Berland continues for five years already. The United Nation decided to end the bloodshed.Berland consists o…
题目: Problem F. Matrix GameInput file: standard inputOutput file: standard inputTime limit: 1 secondMemory limit: 256 mebibytesAlice and Bob are playing the next game. Both have same matrix N × M filled with digits from 0 to 9.Alice cuts the matrix ve…
题目:Problem J. TerminalInput file: standard inputOutput file: standard inputTime limit: 2 secondsMemory limit: 256 mebibytesN programmers from M teams are waiting at the terminal of airport. There are two shuttles at the exitof terminal, each shuttle…
题目:Problem L. Canonical duelInput file: standard inputOutput file: standard outputTime limit: 2 secondsMemory limit: 256 megabytesIn the game «Canonical duel» board N × M is used. Some of the cells of the board contain turrets. Aturret is the unit wi…
题目:Problem D. Clones and TreasuresInput file: standard inputOutput file: standard outputTime limit: 1 secondMemory limit: 256 mebibytesThe magical treasury consists of n sequential rooms. Due to construction of treasury its impossible togo from room…
题意:给你一张简单无向图(但可能不连通),再给你一个K,让你求解任意一个问题:K染色或者输出一条K长路径. 直接贪心染色,对一个点染上其相邻的点的颜色集合之中,未出现过的最小的颜色. 如果染成就染成了.如果到某个点,发现染不成,则倒着按照颜色从大到小回去,则一定恰好可以找出一条K长度的路径. #include<cstdio> #include<cstring> using namespace std; int first[1005],next[20005],v[20005],e,c…
题意:有n个土豆,每个有体积V(i),你可以将每个土豆等分为不超过K份,问你最大块和最小块比值最小为多少. 直接枚举切法,只有n*K种,然后保证其为最大块,去算其他块的切法,即让其他块切得尽可能大即可.O(n*n*K). #include<cstdio> #include<cstring> using namespace std; int n,K,a[105],ans1=150,ans2=1,x[105],ansx[105]; int main(){ // freopen(&quo…
有两辆车,容量都为K,有n(10w)个人被划分成m(2k)组,依次上车,每个人上车花一秒.每一组的人都要上同一辆车,一辆车的等待时间是其停留时间*其载的人数,问最小的两辆车的总等待时间. 是f(i,j)表示前i组,j个人是否可行.w(i)表示第i组的人数. if f(i,j)==1 then f(i+1,j+w(i+1))=1. 这是个bitset可以做的事情,每次左移以后或上f(i-1)的bitset即可.其实可以滚动数组. 然后每更新一次bitset,求一下其最左侧的1的位置,就是对于第一辆…