Factor

恢复

昨天的一道题...

失去理想,成为一条咸鱼。。。

计算系数

输入文件:factor.in

输出文件:factor.out

提交文件:factor.pas/cpp

时间限制:1S

空间限制:128M

题目描述:

给定一个多项式(ax + by)k,请求出多项式展开后xn ym项的系数。

输入格式:

共一行,包含 5 个整数,分别为a,b,k,n,m,每两个整数之间用一个空格隔开。

输出格式:

输出共 1 行,包含一个整数,表示所求的系数,这个系数可能很大,输出对10007

模后的结果。

这题还是很水啊。。(捂脸...这么水还没过。。qwq

其实就是二项式定理emmmm

#include<iostream>
    #include<cstdio>
    #include<algorithm>
    #include<cmath>
    #include<cstring>
    using namespace std;
    int a,b,k,n,m;
    long long f[1005][1005];
    int main()
    {
        scanf("%d%d%d%d%d",&a,&b,&k,&n,&m);
        f[0][0]=1;
        for (int i=0;i<=n;i++)
            for (int j=0;j<=m;j++)
            {
                if (i==0 && j==0) continue;
                f[i][j]=0;
                if (i>0)
                    f[i][j]=(f[i][j]+f[i-1][j]*a)%10007;
                if (j>0)
                    f[i][j]=(f[i][j]+f[i][j-1]*b)%10007;
            }
        printf("%lld\n",f[n][m]);
        return 0;
    }

希望这是最后一次自己这么丧了。。。

原文地址:https://www.cnblogs.com/Grigory/p/10083893.html

时间: 12-06

Factor的相关文章

POJ3048 Max Factor

本文版权归ljh2000和博客园共有,欢迎转载,但须保留此声明,并给出原文链接,谢谢合作. 本文作者:ljh2000作者博客:http://www.cnblogs.com/ljh2000-jump/转载请注明出处,侵权必究,保留最终解释权!   Description To improve the organization of his farm, Farmer John labels each of his N (1 <= N <= 5,000) cows with a distinct s

[2016-02-19][UVA][129][Krypton Factor]

UVA - 129 Krypton Factor Time Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %llu Submit Status Description You have been employed by the organisers of a Super Krypton Factor Contest in which contestants have very high mental and physica

因子分析 (Factor Analysis Sharp)

In my understanding, factor analysis is a method developed to avoid the mass estimation of the variance-covariance matrix when doing Markowitz Allocation. Factor Analysis breakdown the risk factors in stocks into risk factors in portfolio. It apply t

Krypton Factor

Krypton Factor Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 181    Accepted Submission(s): 60 Problem Description You have been employed by the organisers of a Super Krypton Factor Contest in

hdu 5428 The Factor(素数筛选合数分解)

题意:求一串数乘积的因子中的最小合数: 思路:比赛时枚举因子,枚举到两个时结束,估计超时,结果果然被叉了: 将每个数分解,取最小的两个质因子,若数目少于2,则不存在: #include<cstdio> #include<cstring> #include<vector> #include<algorithm> using namespace std; int t,n,m; int num[505]; const int MAXN=100000; int pr

Stat3—因子分析(Factor Analysis)

http://www.datasoldier.net/post/40.html http://wenku.baidu.com/view/4904e121192e45361066f522.html http://wenku.baidu.com/link?url=EwayX82S9pd1TO486JW4iEK2YEjTB-FuNiDlKeVRJ_bEJ4UfubCXbfsCErAw0ZTzfWVtFQvBCXr_7x1CclrYxRtPnVlrwFzyMqE_R9Q8dVW http://wenku

What does a Bayes factor feel like?(转)

A Bayes factor (BF) is a statistical index that quantifies the evidence for a hypothesis, compared to an alternative hypothesis (for introductions to Bayes factors, see here, here or here). Although the BF is a continuous measure of evidence, humans

HDU2710_Max Factor【水题】【筛法求素数】

Max Factor Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3966    Accepted Submission(s): 1289 Problem Description To improve the organization of his farm, Farmer John labels each of his N (1

HDU2136_Largest prime factor【水题】【筛法求素数】

Largest prime factor Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 7216    Accepted Submission(s): 2559 Problem Description Everybody knows any number can be combined by the prime number. Now

因子分析(Factor analysis)

1.引言 在高斯混合和EM算法中,我们运用EM算法拟合混合模型,但是我们得考虑得需要多少的样本数据才能准确识别出数据中的多个高斯模型!看下面两种情况的分析: 第一种情况假如有 m 个样本,每个样本的维度是 n, 如果 n » m, 这时哪怕拟合出一个高斯模型都很困难,更不用说高斯混合, 为什么呢? 这和解多元线性方程组是一样的道理,就是自变量的个数多于非线性相关的方程的个数,这必然导致解的不唯一,虽然在解方程的时候可以随便选一个解满足方程组,但是对于某一实际数据集,往往样本对应的概率分布在客观上