content stringlengths 263 5.24M | pred_label stringclasses 1
value | pred_score_pos float64 0.6 1 |
|---|---|---|
# 题目
As we all know, Hanoi Tower can be solved in 2^n-1 steps if there are n disks. We might adhere to such rules:<br>
1) When the step number is odd, move the smallest disk to the next pillar (in the order A->B->C->A��).<br>
2) When the step number is even, move one disk between the pillar without the smallest disk.
... | __label__POS | 0.948297 |
# 题目
The binomial coefficient C(n, k) has been extensively studied for its importance in combinatorics. Binomial coefficients can be recursively defined as follows:
```
C(n, 0) = C(n, n) = 1 for all n > 0;
C(n, k) = C(n − 1, k − 1) + C(n − 1, k) for all 0 < k < n.
```
Given n and k, you are to determine the parity of C... | __label__POS | 0.992254 |
# 题目
Alice has invented an Auto-Calculation Machine (ACM) that operates on very large integer arrays. The machine is so simple that only one operation of the format sum(i, j) can be performed on it. An operation sum(i, j) means to calculate the sum of all integers between the i-th and j-th ones (inclusive) in the arra... | __label__POS | 0.991327 |
# 题目
RSA is the best-known public key encryption algorithm. In this algorithm each participant has a private key that is shared with no one else and a public key which is published so everyone knows it. To send a secure message to this participant, you encrypt the message using the widely known public key; the particip... | __label__POS | 0.931346 |
# 题目
Bounty hunter is a hero who always moves along cities to earn money by his power. One day he decides to <var>N</var> cities one by one
At the beginning ,Bounty hunter has <var>X</var> money and <var>Y</var> points of Attack force. At day 1, he will goes to city 1, then city 2 at day 2, city 3 at day 3, ... At las... | __label__POS | 0.932379 |
# 题目
Farmer John has gone to town to buy some farm supplies. Being a very efficient man, he always pays for his goods in such a way that the smallest number of coins changes hands, i.e., the number of coins he uses to pay plus the number of coins he receives in change is minimized. Help him to determine what this minim... | __label__POS | 0.965294 |
# 题目
A regular palindrome is a string of numbers or letters that is the same forward as backward. For example, the string "ABCDEDCBA" is a palindrome because it is the same when the string is read from left to right as when the string is read from right to left.
A mirrored string is a string for which when each of the ... | __label__POS | 0.995186 |
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// ES6 draft rev34 (2015/02/20) 21.2.5.3 get RegExp.prototype.flags
function RegExpFlagsGetter() {
// Steps 1-... | __label__POS | 0.839813 |
# 题目
It's election time. The farm is partitioned into a 5x5 grid of cow locations, each of which holds either a Holstein ('H') or Jersey ('J') cow. The Jerseys want to create a voting district of 7 contiguous (vertically or horizontally) cow locations such that the Jerseys outnumber the Holsteins. How many ways can thi... | __label__POS | 0.910968 |
# 题目
When printing out a document, normally the first page is printed first, then the second, then the third, and so on until the end. However, when creating a fold-over booklet, the order of printing must be altered. A fold-over booklet has four pages per sheet, with two on the front and two on the back. When you stac... | __label__POS | 0.796298 |
# 题目
There are problems easy to human brain, but hard to computers. For example, a man can tell whether two shapes overlap by a single glimpse, but a computer will have to check this and that before giving a correct answer.
In this problem, you are asked to write a program that checks whether two shapes overlap. Two s... | __label__POS | 0.811817 |
# 题目
We are all familiar with pre-order, in-order and post-order traversals of binary trees. A common problem in data structure classes is to find the pre-order traversal of a binary tree when given the in-order and post-order traversals. Alternatively, you can find the post-order traversal when given the in-order and ... | __label__POS | 0.999886 |
# 题目
We say that a set S = {x1, x2, ..., xn} is factor closed if for any xi ∈ S and any divisor d of xi we have d ∈ S. Let’s build a GCD matrix (S) = (sij), where sij = GCD(xi, xj) – the greatest common divisor of xi and xj. Given the factor closed set S, find the value of the determinant:
<center>Errorr!</center>
输入... | __label__POS | 0.999871 |
# 题目
For sequences of integers a and b, if you can make the two sequences the same by deleting some elements in a and b, we call the remaining sequence "the common sub sequence". And we call the longest one the LCS.
Now you are given two sequences of integers a and b . You can arrange elements in a and b in any order.... | __label__POS | 0.999396 |
# 题目
A tree is a well-known data structure that is either empty (null, void, nothing) or is a set of one or more nodes connected by directed edges between nodes satisfying the following properties.
There is exactly one node, called the root, to which no directed edges point.
Every node except the root has exactly one ... | __label__POS | 0.971909 |
# 题目
Given a prime P, 2 <= P < 2^31, an integer B, 2 <= B < P, and an integer N, 2 <= N < P, compute the discrete logarithm of N, base B, modulo P. That is, find an integer L such that
B^L == N (mod P)
Input
Read several lines of input, each containing P,B,N separated by a space, and for each line print the logarith... | __label__POS | 0.999422 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright © 2018 hzshang <hzshang15@gmail.com>
'''
basic vuln:
edit function, when input len=0x100, the LSB of rbp will be tampered to \x00, and cause a stack shifting.
then we can pre-overwrite the first arg of scanf in main function, and trigger ... | __label__POS | 0.690944 |
# 题目
Let x and y be two strings over some finite alphabet A. We would like to transform x into y allowing only operations given below:
Deletion: a letter in x is missing in y at a corresponding position.<br>
Insertion: a letter in y is missing in x at a corresponding position.<br>
Change: letters at corresponding posi... | __label__POS | 0.779825 |
# 题目
Consider a single-elimination football tournament involving 2 n teams, denoted 1, 2, …, 2 n . In each round of the tournament, all teams still in the tournament are placed in a list in order of increasing index. Then, the first team in the list plays the second team, the third team plays the fourth team, etc. The ... | __label__POS | 0.724231 |
# 题目
We have a real value x and two infinite sequences A and B. We know that B0 = 1. And for each i larger than zero, we know that:

 When one catches the ball and is thinking left, she throws it back across the circle one place to the left (fr... | __label__POS | 0.978121 |
# 题目
ZOJ is 10 years old! For celebrating, we are offering the easiest problem in the world to you.
Recently we received a long sequence. We can modify the sequence once by the following two steps.
Choose any element in the sequence, say x(satisfying x ≥ 3), and subtract 3 from x.<br>
Choose any element in the sequen... | __label__POS | 0.99465 |
# 题目
In a knockout tournament there are 2^n players. One loss and a player is out of the tournament. Winners then play each other with the new winners advancing until there is only one winner left. If we number the players 1, 2, 3, ..., 2^n, with the first round pairings 2k - 1 vs 2k, for k = 1, 2, ..., 2^(n-1), then w... | __label__POS | 0.728465 |
# 题目
When the scientists explore the sea base, they use a kind of auto mobile robot, which has the mission to collect the swatches of resource of the sea base. The collections of the resource are taken to the research ship and classified, and then the research ship goes back to the mainland -- the research centre where... | __label__POS | 0.958361 |
# 题目
Alice and Bob is playing a game, and this time the game is all about the absolute value!
Alice has <var>N</var> different positive integers, and each number is not greater than <var>N</var>. Bob has a lot of blank paper, and he is responsible for the calculation things. The rule of game is pretty simple. First, A... | __label__POS | 0.987883 |
# 题目
A closed polygon is a figure bounded by a finite number of line segments. The intersections of the bounding line segments are called the vertices of the polygon. When one starts at any vertex of a closed polygon and traverses each bounding line segment exactly once, one comes back to the starting vertex.
A closed... | __label__POS | 0.656741 |
# 题目
In a maze of size M by N, there is a savage hound named "Fatdog". Fatdog keeps moving around, and will have a good bite at his victim as soon as anyone moves into his sightline. You are supposed to compute the minimum time taken to cross this maze alive, and Fatdog must be for sure avoided.
In every time unit, yo... | __label__POS | 0.619777 |
# 题目
There is a digit string <var>S</var> with infinite length. In addition, <var>S</var> is periodic and it can be formed by concatenating infinite repetitions of a base string <var>P</var>. For example, if <var>P</var> = 3423537, then <var>S</var> = 3423537342353734235373423537...
Let's define the alternating sum on... | __label__POS | 0.997493 |
# 题目
Fleeting time does not blur my memory of you. Can it really be 4 years since I first saw you? I still remember, vividly, on the beautiful Zhuhai Campus, 4 years ago, from the moment I saw you smile, as you were walking out of the classroom and turned your head back, with the soft sunset glow shining on your rosy c... | __label__POS | 0.875593 |
# 题目
An equal sum partition of a sequence of numbers is a grouping of the numbers (in the same order as the original sequence) in such a way that each group has the same sum. For example, the sequence:
2 5 1 3 3 7
may be grouped as:<br>
(2 5) (1 3 3) (7)
to yield an equal sum of 7.
Note: The partition that puts all... | __label__POS | 0.981129 |
# 题目
Bob wants to hold a race to encourage people to do sports. He has got trouble in choosing the route. There are N houses and N - 1 roads in his village. Each road connects two houses, and all houses are connected together. To make the race more interesting, he requires that every participant must start from a diffe... | __label__POS | 0.989861 |
# 题目
Mirko has decided to rob mini-safe owned by his son so that he could take away some football stickers which are missing in his big sticker collection.
Lock on the safe consists of N equal discs, each of them being divided in 10,000,000 equal segments numbered from 1 to 10,000,000 clockwise. In the begining, segme... | __label__POS | 0.81103 |
# 题目
Saigyouji Yuyuko and Konpaku Youmu are going to hold a hanami party (a Japanese traditional custom of enjoying the beauty of cherry blossoms). They decide to invite all their friends to come to the yard enjoying the feast under the flowering trees, and sometimes the party will go on until late at night.

It is said that the left lift of our library is a very dangerous place. There are many horrific ghost stories about it. Most st... | __label__POS | 0.970175 |
# 题目
Recently there is a new game called <<Alice Madness Return>>. In this game, Alice was trapped in the wonderland by some evil spirits and she also lost her memory. The player need to help Alice find her memory and escape from wonderland.
 opened a new office in Bucharest, equipped with a modern computing environment provided by IBM Romania, and using modern information technologies. As usual, each client of the bank is identified by a positive integer K and, upon arriving to the bank for some ... | __label__POS | 0.832153 |
# 题目
Consider N different lines on the plane. They divide it to several parts, some of which are finite, some infinite.
Your task in this problem is for each finite part to find its area.
This problem contains multiple test cases!
The first line of a multiple input is an integer N, then a blank line followed by N i... | __label__POS | 0.971133 |
# 题目
Many gas stations use plastic digits on an illuminated sign to indicate prices. When there is an insufficient quantity of a particular digit, the attendant may substitute another one upside down.
The digit "6" looks much like "9" upside down. The digits "0", "1" and "8" look like themselves. The digit "2" looks a... | __label__POS | 0.900693 |
# 题目
You must have heard of the literature "Alice's Adventures in Wonderland"! The 3D film "Alice in Wonderland" published by Disney Company becomes the most popular film in 2010! Today, Alice starts her new adventure in Wonderland again!
In Wonderland, there are n cities, numbered from 1 to n. The capital is city 1. ... | __label__POS | 0.806868 |
# 题目
One day Leon finds a very classic game called Wumpus.The game is as follow.
Once an agent fell into a cave. The legend said that in this cave lived a kind of monster called Wumpus, and there were horrible pits which could lead to death everywhere. However, there were also a huge amount of gold in the cave. The ag... | __label__POS | 0.88162 |
# 题目
The army is going to have a military exercise. The General has divided his men into two groups, Blue and Red. Just before the exercise, the General found out that M pairs of people are close friends. In his opinion, if two people from different groups are close friends, the training may be affected by the emotiona... | __label__POS | 0.969168 |
# 题目
n boxes are placed on the vertices of a rooted tree, which are numbered from 1 to n, 1 The task is to move the marbles such that each box contains exactly one marble. This is to be accomplished be a sequence of moves; each move consists of moving one marble to a box at an adjacent vertex. What is the minimum numbe... | __label__POS | 0.991881 |
# 题目
S is a set of 52 declarations, which is represented by lower case letters ('a', 'b', ..., 'z') and upper case letters ('A', 'B', ..., 'Z'). These declarations are not completely independent with each other, And from some of them, we can deduce some others. We denote this relation as "=>". For instance, a => b mean... | __label__POS | 0.945663 |
# 题目
Data-mining huge data sets can be a painful and long lasting process if we are not aware of tiny patterns existing within those data sets.
One reputable company has recently discovered a tiny bug in their hardware video processing solution and they are trying to create software workaround. To achieve maximum perf... | __label__POS | 0.95521 |
# 题目
Farmer John regrets having applied high-grade fertilizer to his pastures since the grass now grows so quickly that his cows no longer need to move around when they graze. As a result, the cows have grown quite large and lazy... and winter is approaching.
Farmer John wants to build a set of barns to provide shelte... | __label__POS | 0.997135 |
# 题目
Tom is good at making stean, he can make steans of various color and shape. Now he want to know how many water it can contain, and how many material he need to making a stean.

The shape of the stean follows rules below:
1. The horiz... | __label__POS | 0.944741 |
# 题目
KEY Inc., the leading company in security hardware, has developed a new kind of safe. To unlock it, you don't need a key but you are required to enter the correct n-digit code on a keypad (as if this were something new!). There are several models available, from toy safes for children (with a 2-digit code) to the ... | __label__POS | 0.659871 |
# 题目
Severe acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. To minimize transmission to others, the best strategy is to separate the suspects from others.
In the Not-Spreading-Your-Sickness University (NSYSU), there are many student gro... | __label__POS | 0.961425 |
# 【NO.382】阿里云全球实时传输网络GRTN—QOE优化实践
**编者按:** 直播已深入每家每户,以淘宝的直播为例,在粉丝与主播的连麦互动中如何实现无感合屏或切屏?LiveVideoStackCon 2022音视频技术大会上海站邀请到了阿里云GRTN核心网技术负责人肖凯,为我们分享GRTN核心网的运作机制、运用方面以及QOE的网络模型在业务板块的实践优化。
文/肖凯
整理/LiveVideoStack

大家好,欢迎大家来到 LiveVideoStac... | __label__POS | 0.888502 |
# 题目
rank N. Stein is a very conservative high-school teacher. He wants to take some of his students on an excursion, but he is afraid that some of them might become couples. While you can never exclude this possibility, he has made some rules that he thinks indicates a low probability two persons will become a couple:... | __label__POS | 0.986379 |
# 题目
In how many ways can you tile a 2xn rectangle by 2x1 or 2x2 tiles?
Here is a sample tiling of a 2x17 rectangle.

输入描述
Input is a sequence of lines, each line containing an integer nu
输出描述
For each line of input, output one integer ... | __label__POS | 0.985924 |
# 【NO.545】磁盘存储链式的 B 树与 B+树
## 1.B树的介绍
**在讲B树之前我们先讨论一下内存与磁盘有什么区别?**
对于这个问题很多朋友或多或少可以说点出来
可能很多朋友答的第一点就是
1.内存快磁盘慢
2.断电以后数据消失,磁盘持久存储
 of the sequence of breed IDs above. FJ is curious... | __label__POS | 0.987801 |
# 题目
H.L. is preparing a circuit for the next coming physical experiment. His circuit consists of N nodes, numbered 1 to N, which are connected by wires with certain resistance. H.L is curious about the equivalent resistance between Node 1 and Node N.
输入描述
The first line contains two positive integers N and M, the nu... | __label__POS | 0.94113 |
# 题目
When shopping on Long Street, Michael usually parks his car at some random location, and then walks to the stores he needs. Can you help Michael choose a place to park which minimises the distance he needs to walk on his shopping round? Long Street is a straight line, where all positions are integer. You pay for p... | __label__POS | 0.963759 |
# 题目
A well known algorithm called heapsort is often used when deterministic sorting algorithm with O(n log n) time and O(1) additional memory is needed. Let us describe the heapsort algorithm briefly. We will describe sorting of an array of different integer numbers, although generally heapsort can be applied to any a... | __label__POS | 0.992838 |
# 题目
Diablo II is the most famous ARPG (Act Role Playing Game) game in the world developped by Blizzard company. Diablo III is coming soon and Cannon group is reviewing Diablo II these days.
In Diablo II, there are generally two kinds of items: normal items and magic items. Normal items have no magic power, while the ... | __label__POS | 0.943015 |
# 题目
Write a program that, given three positive integers x, y and z (x, y, z < 232, x ≤ y), computes the bitwise exclusive disjunction (XOR) of the arithmetic progression x, x + z, x + 2z, …, x + kz, where k is the largest integer such that x + kz ≤ y.
输入描述
The input contains multiple test cases. Each test case consi... | __label__POS | 0.999426 |
# 题目
Given N numbers, X<sub>1</sub>, X<sub>2</sub>, ... , X<sub>N</sub> , let us calculate the difference of every pair of numbers: ∣X<sub>i</sub> - X<sub>j</sub> ∣ (1 ≤ i < j ≤ N). We can get C(N,2) differences through this work, and now your task is to find the median of the differences as quickly as you can!
Note i... | __label__POS | 0.999733 |
# 题目
The FORTH programming language does not support floating-point arithmetic at all. Its author, Chuck Moore, maintains that floating-point calculations are too slow and most of the time can be emulated by integers with proper scaling. For example, to calculate the area of the circle with the radius R he suggests to... | __label__POS | 0.986409 |
# 题目
Farmer John's cows are getting restless about their poor telephone service; they want FJ to replace the old telephone wire with new, more efficient wire. The new wiring will utilize N (2 ≤ N ≤ 100,000) already-installed telephone poles, each with some heighti meters (1 ≤ height<sub>i</sub> ≤ 100). The new wire wil... | __label__POS | 0.96185 |
# 题目
Let's consider arithmetic expressions (addition or subtraction) over non-negative decimal integers. The expression syntax is as follows:
the first operand;<br>
the operator sign ('+' or '‑');<br>
the second operand;<br>
the character '=';<br>
the result of the operation (sum or difference, according to the operat... | __label__POS | 0.97922 |
# 题目
The kingdom Eintagra is in great danger! Overwhelming enemy has surrounded the emperor's castle and once they enter, a massacre is just what is going to be.
Now what all people in the kingdom Eintagra can rely on, is a huge catapult that can throw heavy rocks to the crowd of enemy. The catapult is so huge that it... | __label__POS | 0.965529 |
<?php
/*
Table[
tablename, filepath
[column],
[row],
[row],
...
rbSqlSchema[
rbSqlSchema,/rbSqlSchema,
["tableName","filePath"],
["something","/rbSql_".substr(md5(rand(10000000,100000000)),0,16)]
]
*/
define("STR", chr(1), true);
define("ARR", chr(2), true);
define("SCHEMA", "./rbSql/rbSqlSchema", true... | __label__POS | 0.723805 |
# 题目
Starting from point (0,0) on a plane, we have written all non-negative integers 0,1,2, ... as shown in the figure. For example, 1, 2, and 3 has been written at points (1,1), (2,0), and (3, 1) respectively and this pattern has continued.
You are to write a program that reads the coordinates of a point (x, y), and ... | __label__POS | 0.986034 |
# 题目
Edward is a rich man. He owns a large factory for health drink production. As a matter of course, there is a large warehouse in the factory.
To ensure the safety of drinks, Edward hired a security man to patrol the warehouse. The warehouse has <var>N</var> piles of drinks and <var>M</var> passageways connected th... | __label__POS | 0.990761 |
# 题目
This is a super simple problem. The description is simple, the solution is simple. If you believe so, just read it on. Or if you don't, just pretend that you can't see this one.
We say an element is inside a matrix if it has four neighboring elements in the matrix (Those at the corner have two and on the edge hav... | __label__POS | 0.96543 |
# 题目
A computer professor, who is fond of programming, has come to Tehran to pay a visit to our regional contest. After hearing about such an event, he has tried his best to be able to participate in the contest as a visitor. He would decide to hold such contests in his university, if he finds it fun enough.
As could ... | __label__POS | 0.9192 |
# 题目
The company Chris Ltd. is preparing a new sorting hardware called Maximizer. Maximizer has N inputs numbered from 1 to N. Each input represents one integer. Maximizer has one output which represents the maximum value present on Maximizer's inputs.
Maximizer is implemented as a pipeline of sorters Sorter(i[1], j[1... | __label__POS | 0.712405 |
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// We use varying sorts across the self-hosted codebase. All sorts are
// consolidated here to avoid confusion and... | __label__POS | 0.723153 |
# 题目
Boudreaux and Thibodeaux aren‘t very good at math, so they need you to write a program that can determine the second degree polynomial used to generate a given sequence of three integers. As proof that you’ve figured out the polynomial, they want your program to print out the next <tt>3</tt> integers in the sequen... | __label__POS | 0.610976 |
# 题目
A magician invented a new card trick and presented it in the prestigious American Conference of Magicians (ACM). The trick was so nice it received the "Best Magic Award" at the conference. The trick requires three participants: the magician himself, a spectator and an assistant. During the trick the spectator is a... | __label__POS | 0.840105 |
# 题目
Few weeks ago, a famous software company has upgraded its instant messaging software. A ranking system was released for user groups. Each member of a group has a level placed near his nickname. The level shows the degree of activity of a member in the group.
Each member has a score based his behaviors in the grou... | __label__POS | 0.874067 |
# 题目
Consider the point sets in figures 1a, 2a, and 3a. Using only those points as vertices, figures 1b, 2b, and 3b show all the rectangles that can be formed with horizontal and vertical sides. No rectangles can be formed from the points in figure 4.

This distributed storage system contains a group of backend servers and a master server. The backend servers are ... | __label__POS | 0.706353 |
# 题目
Xuanxuan has n sticks of different length. One day, she puts all her sticks in a line, represented by S1, S2, S3, ...Sn. After measuring the length of each stick Sk (1
Now given the length of S1, S2, S3, …Sn, you are required to find the maximum value j - i.
输入描述
The input contains multiple test cases. Each case... | __label__POS | 0.999992 |
# 题目
"Never End" is a flash game. Here, we consider a simplified version of it. A world is represented by a board of N by M, where each grid may be empty or a block. The world is surrounded by blocks with one empty grid being the exit. The player can use the following four operations to escape from the world (get to th... | __label__POS | 0.974736 |
# 题目
Darkgy is a transport pipe master. One day, due to some strange redstone signal, an Iron pipe changed its direction and make a part of the pipe system become a circulation pipe.
The circulation pipe consists of L unit pipe numbered from 0 to <var>L</var>-1. Every <var>K</var> ticks, an item will input into pipe 0... | __label__POS | 0.8346 |
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
function ViewedArrayBufferIfReified(tarray) {
assert(IsTypedArray(tarray), "non-typed array asked for its buff... | __label__POS | 0.711743 |
# 题目
Binary code is a mapping of characters of some alphabet to the set of finite length bit sequences. For example, standard ASCII code is a fixed length code, where each character is encoded using 8 bits.
Variable length codes are often used to compress texts taking into account the frequencies of occurence of diffe... | __label__POS | 0.989199 |
# 题目
Assume that there are lots of two colors of black and white Go Game Pieces in a box, we take out n Go Game Pieces (0<br>
For example, when n=8, m=2, k=2, the situation is as following:

```
Original first repetition second repetit... | __label__POS | 0.986855 |
# 题目
You travel a lot by bus and the costs of all the seperate tickets are starting to add up.
Therefore you want to see if it might be advantageous for you to buy a bus pass.
The way the bus system works in your country (and also in the Netherlands) is as follows:
when you buy a bus pass, you have to indicate a cen... | __label__POS | 0.94325 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.