UVa11714 - Blind Sorting

简介: UVa11714 - Blind Sorting
#include <iostream>#include <cmath>#include <fstream>usingnamespacestd;
intmain()
{
intn;
#ifndef ONLINE_JUDGEifstreamfin("d:\\OJ\\uva_in.txt");
streambuf*old=cin.rdbuf(fin.rdbuf());
#endifwhile (cin>>n) {
cout<<n+ (int)ceil(log2(n)) -2<<endl;
    }
#ifndef ONLINE_JUDGEcin.rdbuf(old);
#endifreturn0;
}
目录
相关文章
UVa11565 - Simple Equations
UVa11565 - Simple Equations
55 0
UVa11296 - Counting Solutions to an Integral Equation(枚举技巧)
UVa11296 - Counting Solutions to an Integral Equation(枚举技巧)
56 0
UVa10776 - Determine The Combination(有重复元素的组合问题)
UVa10776 - Determine The Combination(有重复元素的组合问题)
50 0
|
算法
LeetCode 300. Longest Increasing Subsequence
给定一个无序的整数数组,找到其中最长上升子序列的长度。
58 0
LeetCode 300. Longest Increasing Subsequence
|
数据库
When Tech Meets Love – Smarter Ways to NOT be Single
It’s that time of year again. Single’s Day (a.k.a Double 11) is just around the corner, people buying gifts for loved ones.
1636 0
When Tech Meets Love – Smarter Ways to NOT be Single
|
Linux
[LeetCode] Longest Increasing Subsequence
A typical O(n^2) solution uses dynamic programming. Let's use lens[j] to denote the length of the LIS ending with nums[j].
856 0
[Algorithms] Longest Increasing Subsequence
The Longest Increasing Subsequence (LIS) problem requires us to find a subsequence t of a given sequence s, such that t satisfies two requirements: ...
789 0