hihoCoder 1595 : Numbers】的更多相关文章

Description You are given n constant integers c[1], c[2], ..., c[n] and an integer k. You are to assign values to 2k integer variables, x[1], x[2], ..., x[k], y[1], y[2], ..., y[k], such that, (1) For each 1 ≤ i ≤ k, x[i] ≤ y[i] holds, (2) For each 1…
#1595 : Numbers 时间限制:8000ms 单点时限:1000ms 内存限制:256MB 描述 给定n个整数常数c[1], c[2], ..., c[n]和一个整数k.现在需要给2k个整数变量x[1], x[2], ..., x[k], y[1], y[2], ..., y[k]赋值,满足 (1)对于所有1 ≤ i ≤ k,都有x[i] ≤ y[i]. (2)对于所有1 ≤ i ≤ n,都存在至少一个j (1 ≤ j ≤ k),使得x[j] ≤ c[i] ≤ y[j]. 求出S=(y…
题目大意 考虑自然数构成的序列 $a$:$01234567891011\dots$,序列下标从 $0$ 开始,即 $a_0 =0, a_1 = 1$ . 求 $a_n$($0\le n\le 10^{18}$). 解法 设 $a_n$ 所在的数字为 $x(n)$ . 首先不难求出 $x(n)$ 的位数, 设其为 $k$ . 从而可以求出 $x(n)$ 是第几个 $k$ 位数,这样也就求出了 $x(n)$ . 设 $x(n)$ 是第 $i$($i\ge 1$)个 $k$ 位数,则有 $$ i =…
hihoCoder #1432 : JiLi Number(吉利数) 时间限制:1000ms 单点时限:1000ms 内存限制:256MB Description - 题目描述 Driver Ji likes the digit "1". He has an accumulator which shows the sum of input number. He lists all of positive number no more than N and starts counting…
Description In the city, there is a one-way straight highway starts from the northern end, traverses the whole city southward, and finishes at the southern end. Due to some financial difficulties, there is only one lane on this highway, which means t…
http://hihocoder.com/problemset/problem/1873 时间限制:1000ms 单点时限:1000ms 内存限制:512MB 描述 A small frog wants to get to the other side of a river. The frog is initially located at one bank of the river (position 0) and wants to get to the other bank (positio…
在Java位运算总结-leetcode题目博文中总结了Java提供的按位运算操作符,今天又碰到LeetCode中一道按位操作的题目 Given a range [m, n] where 0 <= m <= n <= 2147483647, return the bitwise AND of all numbers in this range, inclusive. For example, given the range [5, 7], you should return 4. 题意:…
Sum of Consecutive Prime Numbers Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 20050   Accepted: 10989 Description Some positive integers can be represented by a sum of one or more consecutive prime numbers. How many such representatio…
You are given two linked lists representing two non-negative numbers. The most significant digit comes first and each of their nodes contain a single digit. Add the two numbers and return it as a linked list. You may assume the two numbers do not con…
Given a non-empty array of numbers, a0, a1, a2, … , an-1, where 0 ≤ ai < 231. Find the maximum result of ai XOR aj, where 0 ≤ i, j < n. Could you do this in O(n) runtime? Example: Input: [3, 10, 5, 25, 2, 8] Output: 28 Explanation: The maximum resul…