随笔分类 - cf
摘要:Kolya is going to make fresh orange juice. He has n oranges of sizes a1, a2, ..., an. Kolya will put them in the juicer in the fixed order, starting w
阅读全文
摘要:Opposite to Grisha's nice behavior, Oleg, though he has an entire year at his disposal, didn't manage to learn how to solve number theory problems in
阅读全文
摘要:题意翻译 Description 有一个长为nnn ,宽为mmm 的鱼缸,还有一个边长为rrr 的正方形渔网。你可以往鱼缸里放kkk 条鱼,问用渔网随机在浴缸里捞鱼的最大期望是多少。不懂什么是期望的自己去百度 Input 一行4个正整数代表n,m,r,kn, m, r, kn,m,r,k Outpu
阅读全文
摘要:Since Grisha behaved well last year, at New Year's Eve he was visited by Ded Moroz who brought an enormous bag of gifts with him! The bag contains n s
阅读全文
摘要:A. Tricky Alchemy time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output During the winter holid
阅读全文
摘要:One day, after a difficult lecture a diligent student Sasha saw a graffitied desk in the classroom. She came closer and read: "Find such positive inte
阅读全文
摘要:Quite recently a creative student Lesha had a lecture on trees. After the lecture Lesha was inspired and came up with the tree of his own which he cal
阅读全文
摘要:Many students live in a dormitory. A dormitory is a whole new world of funny amusements and possibilities but it does have its drawbacks. There is onl
阅读全文
摘要:Ehab is interested in the bitwise-xor operation and the special graphs. Mahmoud gave him a problem that combines both. He has a complete graph consist
阅读全文
摘要:Mahmoud has an array a consisting of n integers. He asked Ehab to find another array b of the same length such that: b is lexicographically greater th
阅读全文
摘要:When Kefa came to the restaurant and sat at a table, the waiter immediately brought him the menu. There were n dishes. Kefa knows that he needs exactl
阅读全文
摘要:Kefa decided to celebrate his first big salary by going to the restaurant. He lives by an unusual park. The park is a rooted tree consisting of n vert
阅读全文
摘要:Kefa wants to celebrate his first big salary by going to restaurant. However, he needs company. Kefa has n friends, each friend will agree to go to th
阅读全文
摘要:题意翻译 给你一串数列a.对于一个质数p,定义函数f(p)=a数列中能被p整除的数的个数.给出m组询问l,r,询问[l,r]区间内所有素数p的f(p)之和. 题目描述 Recently, the bear started studying data structures and faced the
阅读全文
摘要:The BFS algorithm is defined as follows. to n. Initialize q as a new queue containing only vertex 1, mark the vertex 1 as used. Extract a vertex v fro
阅读全文
摘要:Try guessing the statement from this picture: You are given a non-negative integer d . You have to find two non-negative real numbers a and b such tha
阅读全文
摘要:Mahmoud was trying to solve the vertex cover problem on trees. The problem statement is: Given an undirected tree consisting of n nodes, find the mini
阅读全文
摘要:题目描述 You are given an undirected connected weighted graph consisting of n n n vertices and m m m edges. Let's denote the length of the shortest path f
阅读全文
摘要:It was recycling day in Kekoland. To celebrate it Adil and Bera went to Central Perk where they can take bottles from the ground and put them into a r
阅读全文