LuoguP2759奇怪的函数

本文介绍了一种使用二分查找算法求解特定形式对数方程的方法。通过对变量x及其对数的单调性分析,确定了能够满足不等式的最小整数值。通过C++代码实现了算法,并展示了如何利用二分查找高效解决问题。

先来推一下:
log10xx>n2
xlog10x>n2
x,log10x都是单调递增的
xlog10x是单调递增的
直接二分

/*************************************************************************
    > File Name: 2759.cpp
    > Author: huhao
    > Mail: 826538400@qq.com 
    > Created Time: 2017/5/6 9:49:00
 ************************************************************************/
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<string>
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
using namespace std;
#define inf 0x3f3f3f3f
#define eps 1e-8
#define rt return
#define gc getchar()
#define ll long long
#define fr(i,a,b) for(int i=a,_end_=b;i<=_end_;i++)
#define fd(i,a,b) for(int i=a,_end_=b;i>=_end_;i--)
void SWAP(int a,int b)
{
    a^=b^=a^=b;
}
int read()
{
    int r=1,t=0;
    char c=gc;
    while(c<'0'||c>'9')
    {
        if(c=='-')
            r=-1;
        else
            r=1;
        c=gc;
    }
    while(c>='0'&&c<='9')
    {
        t=t*10+c-48;
        c=gc;
    }
    rt r*t;
}
char readchar(int x,int y)
{
    char c=gc;
    while(c<x||c>y)
        c=gc;
    rt c;
}
long long n,l,r;
int main()
{
#ifndef ONLINE_JUDGE
    freopen("", "r", stdin);
    freopen("", "w", stdout);
#endif
    n=read()-1;
    l=1;
    r=238723448;
    while(l<r)
    {
        long long mid=(l+r)>>1;
        if((log(mid)/log(10)*mid)>=n)
            r=mid;
        else
            l=mid+1;
    }
    printf("%lld\n",l);
    rt 0;
}
In order to perform many signal processing tasks such as classification,pattern recognition and coding, it is helpful to specify a signal model interms of meaningful signal structures. In general, designing such a modelis complicated and for many signals it is not feasible to specify the appropriatestructure. Adaptive models overcome this problem by learningstructures from a set of signals. Such adaptive models need to be generalenough, so that they can represent relevant structures. However, moregeneral models often require additional constraints to guide the learningprocedure.In this thesis a sparse coding model is used to model time-series. Relevantfeatures can often occur at arbitrary locations and the model has to beable to reflect this uncertainty, which is achieved using a shift-invariantsparse coding formulation. In order to learn model parameters, we useBayesian statistical methods, however, analytic solutions to this learningproblem are not available and approximations have to be introduced. Inthis thesis we study three approximations, one based on an analyticalintegral approximation and two based on Monte Carlo approximations.But even with these approximations, a solution to the learning problemis computationally too expensive for the applications under investigation.Therefore, we introduce further approximations by subset selection.Music signals are highly structured time-series and offer an ideal testbedfor the studied model. We show the emergence of note- and score-like featuresfrom a polyphonic piano recording and compare the results to thoseobtained with a different model suggested in the literature. Furthermore,we show that the model finds structures that can be assigned to an individualsource in a mixture. This is shown with an example of a mixturecontaining guitar and vocal parts for which blind source separation canbe performed based on the shift-invariant sparse coding model.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值