问题描述

输出格式

输出一行,输出一个整数,表示方程的整数解的个数。

样例输入


-
 

样例输出


 #include <stdio.h>
#include <string.h>
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <sstream>
const int INF=0x3f3f3f3f;
typedef long long LL;
const int mod=1e9+;
const double PI = acos(-);
const double eps =1e-;
#define Bug cout<<"---------------------"<<endl
const int maxn=1e5+;
using namespace std; int k[],p[];
int n,m,ans;
LL POW[][];//POW[i][j]表示i的j次方 void init()//打表
{
for(int i=;i<=;i++)
{
POW[i][]=;
for(int j=;j<=;j++)
{
POW[i][j]=i*POW[i][j-];
}
}
} void DFS(int step,LL sum)
{
if(step>n)
{
if(sum==) ans++;
return ;
}
for(int i=;i<=m;i++)
DFS(step+,sum+k[step]*POW[i][p[step]]);
} int main()
{
#ifdef DEBUG
freopen("sample.txt","r",stdin);
#endif
ios_base::sync_with_stdio(false);
cin.tie(NULL); scanf("%d %d",&n,&m);
for(int i=;i<=n;i++)
scanf("%d %d",&k[i],&p[i]);
init();//不要忘了
DFS(,);
printf("%d\n",ans); return ;
}

-

最新文章

  1. pwnable echo1
  2. 股票交易(洛谷U6084)
  3. iOS8定位问题解决方案
  4. java泛型的使用
  5. Windows 8上强制Visual Studio以管理员身份运行
  6. Delphi的Owner与Parent可以不一致,而且Owner不是必须存在(一共7个问题) good
  7. android strings.xml转义字符, 注意细节解决(转)
  8. boostrap插件
  9. response 常用详解(1)
  10. Spring AOP分析(1) -- 基本概念
  11. POJ 1849 Two(树的直径--树形DP)(好题)
  12. Alpha冲刺置顶随笔
  13. Linux安装mysql(Redhat6.5+MySQL5.7)(转载+原创补漏)
  14. 翻转 -- CodeForces - 56B
  15. 【原创】大叔经验分享(36)CM部署kafka
  16. FZU 2254 英语考试 (最小生成树)
  17. 洛谷P1605 迷宫【dfs】
  18. python 回溯法 记录
  19. 一次性解决Intellij IDEA maven 自动跳到1.5的JDK
  20. Unity3D Shader基础教程

热门文章

  1. Laravel框架的学习
  2. SQL中行转列(PIVOT)与列转行(UNPIVOT)
  3. C#中类的字段或属性不被序列化成JSON或XML
  4. C#图片闪烁
  5. css mix-blend-mode 颜色滤镜混合模式
  6. HDU - 3068 最长回文(manacher算法)
  7. 每天一点点之vue框架开发 - vue组件之间传值(父向子传值)
  8. python格式字符
  9. WindowsForm ComboBoxList 下拉框带复选框 可以动态添加
  10. 吴裕雄--天生自然 JAVASCRIPT开发学习:switch 语句