随笔分类 - OJ---SPOJ
摘要:Shadowman loves to collect box but his roommates woogieman and itman don't like box and so shadowman wants to hide boxes as many as possible. A box ca
阅读全文
摘要:Problem statement: A string is said to be “PATHETIC” if all the characters in it are repeated the same number of times. You are given a string of leng
阅读全文
摘要:You are given N(1<=N<=100000) integers. Each integer is square free(meaning it has no divisor which is a square number except 1) and all the prime fac
阅读全文
摘要:Given an array of N integers A1, A2, A3…AN. If you randomly choose two indexes i ,j such that 1 ≤ i < j ≤ N, what is the expected value of Ai | Aj? In
阅读全文
摘要:Waca loves maths,.. a lot. He always think that 1 is an unique number. After playing in hours, Waca suddenly realize that every integer can be represe
阅读全文
摘要:As you might already know, Ada the Ladybug is a farmer. She grows a big fruit tree (with root in 0). There is a fruit on every node of the tree. Ada i
阅读全文
摘要:Ada the Ladybug lives near an orange tree. Instead of reading books, she investigates the oranges. The oranges on orange tree can be in up to 5*50 Sha
阅读全文
摘要:Rainbow 6 is a very popular game in colleges. There are 2 teams, each having some members and the 2 teams play some matches against each other. The te
阅读全文
摘要:Problem description. The Fibonacci numbers defined as f(n) = f(n-1) + f(n-2) where f0 = 0 and f1 = 1. We define a function as follows D(n,x) = x + x^2
阅读全文
摘要:You are given an array of size N. How many distinct arrays can you generate by swapping two numbers for exactly once? The two selected numbers can be
阅读全文
摘要:Katniss Everdeen after participating in Hunger Games now wants to participate in NT Games (Number Theory Games). As she begins President Snow provides
阅读全文
摘要:The northern part of the Pyramid contains a very large and complicated labyrinth. The labyrinth is divided into square blocks, each of them either fil
阅读全文
摘要:A positive integer is called a palindrome if its representation in the decimal system is the same when read from left to right and from right to left.
阅读全文
摘要:You are given a tree with N nodes. The tree nodes are numbered from 1 to N. Each node has an integer weight. We will ask you to perform the following
阅读全文
摘要:You are given a sequence A[1], A[2], ..., A[N]. (0 ≤ A[i] < 231, 1 ≤ N ≤ 12000). A query is defined as follows: Query(x,y) = Max { a[i] xor a[i+1] xor
阅读全文
摘要:You have two integers L and R, and you are required to find the max xor value of a and b where L <= a <= R and L <= b <= R Input Two integers in a lin
阅读全文
摘要:Byteotian Interstellar Union (BIU) has recently discovered a new planet in a nearby galaxy. The planet is unsuitable for colonisation due to strange m
阅读全文
摘要:You are given a tree (an undirected acyclic connected graph) with N nodes, and edges numbered 1, 2, 3...N-1. Each edge has an integer value assigned t
阅读全文
摘要:You are given a node-labeled rooted tree with n nodes. Define the query (x, k): Find the node whose label is k-th largest in the subtree of the node x
阅读全文
摘要:ιYou are given a tree (an acyclic undirected connected graph) with N nodes, and edges numbered 1, 2, 3...N-1. We will ask you to perfrom some instruct
阅读全文

浙公网安备 33010602011771号