原题链接
After the mysterious disappearance of Ashish, his two favourite disciples Ishika and Hriday, were each left with one half of a secret message. These messages can each be represented by a permutation of size n. Let’s call them a and b.
Note that…
原题链接
In Omkar’s last class of math, he learned about the least common multiple, or LCM. LCM(a,b) is the smallest positive integer x which is divisible by both a and b.
Omkar, having a laudably curious mind, immediately thought of a problem involving…
原题链接
Constanze is the smartest girl in her village but she has bad eyesight.
One day, she was able to invent an incredible machine! When you pronounce letters, the machine will inscribe them onto a piece of paper. For example, if you pronounce ‘c’,…
原题链接
There are n people who want to participate in a boat competition. The weight of the i-th participant is wi. Only teams consisting of two people can participate in this competition. As an organizer, you think that it’s fair to allow only teams wi…
原题链接
Ashish has an array a of consisting of 2n positive integers. He wants to compress a into an array b of size n−1. To do this, he first discards exactly 2 (any two) elements from a. He then performs the following operation until there are no eleme…
原题链接
Anton likes to listen to fairy tales, especially when Danik, Anton’s best friend, tells them. Right now Danik tells Anton a fairy tale:
“Once upon a time, there lived an emperor. He was very rich and had much grain. One day he ordered to build…
原题链接
Let’s introduce some definitions that will be needed later.
Let prime(x) be the set of prime divisors of x. For example, prime(140){2,5,7}, prime(169){13}.
Let g(x,p) be the maximum possible integer pk where k is an integer such that x is divi…
原题链接
Gildong has an interesting machine that has an array a with n integers. The machine supports two kinds of operations:
Increase all elements of a suffix of the array by 1. Decrease all elements of a suffix of the array by 1. A suffix is a subsegm…
原题链接 题意
t 组样例,n个朋友 ,m个礼物 ,n个朋友每个人对应一个下标 ki ,每个礼物对应的价格为 ci (价格按升序排列)要给每个朋友准备东西,可以给他们买一个不大于 j <ki 的礼物 &#x…
原题链接 题意
t 组样例 ,每组有长度为 n 的数组 a 和 一个数 x ,下一行 输入数组 a如果a[i]%x0 ,那么就将 x个 a[i]/x 放在数组的末尾,然后继续这样的操作,直到a[i]%x!0时停止求数组的和
思路 1.昨天打的比赛,其实题…
原题链接
Alice likes snow a lot! Unfortunately, this year’s winter is already over, and she can’t expect to have any more of it. Bob has thus bought her a gift — a large snow maker. He plans to make some amount of snow every day. On day i he will make …
原题链接
Recently Ivan the Fool decided to become smarter and study the probability theory. He thinks that he understands the subject fairly well, and so he began to behave like he already got PhD in that area.
To prove his skills, Ivan decided to demons…
原题链接
Ashishgup and FastestFinger play a game.
They start with a number n and play in turns. In each turn, a player can make any one of the following moves:
Divide n by any of its odd divisors greater than 1. Subtract 1 from n if n is greater than 1.…
题目链接
You are given an array a of n integers.
You want to make all elements of a equal to zero by doing the following operation exactly three times:
Select a segment, for each number in this segment we can add a multiple of len to it, where len is th…
题目名称: 1002 AB for Polynomials (25 分)
第二道题就让上了一课,甲级的题测试点变多了,坑感觉也多了第一个坑是可能相同指数的项分了好几次写.(没踩)第二个坑是最后系数为0的项不输出(测试点3-6全涉及,踩了…)第三个坑是如果最后全是系数为0的项,只输出个0(测试点6)
题目名…
先贴下题
Painting some colored segments on a line, some previously painted segments may be covered by some the subsequent ones. Your task is counting the segments of different colors you can see at last.
Input
The first line of each data set contains ex…