脑洞太大,简单东西就是想复杂,活该一直DIV2;

A:水,基本判断A[I]<=A[I-1],ANS++;

B:不知道别人怎么做的,我的是100*N*N;没办法想的太多了,忘记是连续的数列

我们枚举公差,找到能有多少就可以了。

C:想到MAP,但是前面太脑掺,只有几分钟写。。

不过还真不一定写的出来。。

进来DP感觉良好。。

我们可以发现其实这些的乘积其实比较少。。

然后就像普通数组进行加法一样。

 #include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
using namespace std; #define PB push_back
#define MP make_pair #define REP(i,n) for(i=0;i<(n);++i)
#define FOR(i,l,h) for(i=(l);i<=(h);++i)
#define FORD(i,h,l) for(i=(h);i>=(l);--i) typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<double> VD;
typedef long long ll;
typedef pair<int,int> PII;
#define mod 1000000007 map<ll,ll> a[];
class GoodSubset
{
public:
int numberOfSubsets(int goodValue, vector <int> d)
{
int n=d.size();
ll ret=;
for (int i=;i<n;i++)
{
for (int j=;j<i;j++)
{
for (map<ll,ll>::iterator it=a[j].begin();it!=a[j].end();it++)
{
ll now=it->first;
int h=it->second;
if (goodValue%now==)
{
a[i][now*d[i]]+=h;
a[i][now*d[i]]%=mod;
}
}
}
a[i][d[i]]++;
a[i][d[i]]%=mod;
ret+=a[i][goodValue];
ret%=mod;
}
return ret;
}
}; int main() //模拟数据自测用
{
int n,m;
cin>>n>>m;
vector<int> p;
for (int i=;i<m;i++)
{
int x;
cin>>x;
p.push_back(x);
}
GoodSubset x;
cout<<x.numberOfSubsets(n,p);
return ;
} //代码还是很好看懂的
// Powered by FileEdit
// Powered by TZTester 1.01 [25-Feb-2003]
// Powered by CodeProcessor

Topcoder srm 632 div2的更多相关文章

  1. Topcoder Srm 673 Div2 1000 BearPermutations2

    \(>Topcoder \space Srm \space 673 \space Div2 \space 1000 \space BearPermutations2<\) 题目大意 : 对 ...

  2. Topcoder Srm 671 Div2 1000 BearDestroysDiv2

    \(>Topcoder \space Srm \space 671 \space Div2 \space 1000 \space BearDestroysDiv2<\) 题目大意 : 有一 ...

  3. 求拓扑排序的数量,例题 topcoder srm 654 div2 500

    周赛时遇到的一道比较有意思的题目: Problem Statement      There are N rooms in Maki's new house. The rooms are number ...

  4. topcoder SRM 628 DIV2 BracketExpressions

    先用dfs搜索所有的情况,然后判断每种情况是不是括号匹配 #include <vector> #include <string> #include <list> # ...

  5. topcoder SRM 628 DIV2 BishopMove

    题目比较简单. 注意看测试用例2,给的提示 Please note that this is the largest possible return value: whenever there is ...

  6. Topcoder SRM 683 Div2 B

    贪心的题,从左向右推过去即可 #include <vector> #include <list> #include <map> #include <set&g ...

  7. Topcoder SRM 683 Div2 - C

    树形Dp的题,根据题意建树. DP[i][0] 表示以i为根节点的树的包含i的时候的所有状态点数的总和 Dp[i][1] 表示包含i结点的状态数目 对于一个子节点v Dp[i][0] = (Dp[v] ...

  8. Topcoder SRM 626 DIV2 SumOfPower

    本题就是求所有连续子数列的和 开始拿到题目还以为求的时数列子集的和,认真看到题目才知道是连续子数列 循环遍历即可 int findSum(vector <int> array) { ; ; ...

  9. Topcoder SRM 626 DIV2 FixedDiceGameDiv2

    典型的条件概率题目. 事件A在另外一个事件B已经发生条件下的发生概率.条件概率表示为P(A|B),读作“在B条件下A的概率”. 若只有两个事件A,B,那么, P(A|B)=P(AB)/P(B) 本题的 ...

随机推荐

  1. MTK机子修复分区信息

    这是前一个星期的事了,最近一直懒得写博客~ 此事是由于我误刷了内核,然后导致分区信息出错... 内置存储挂载不上,也找不到内置存储的分区! 如果不是star的帮助.估计俺的爪机就要返厂了!! 接下来说 ...

  2. book publisher and study

    http://www.apress.com/ https://pragprog.com/ https://www.packtpub.com/ http://www.howzhi.com/

  3. openshift云计算平台diy模式安装Python2.7+Flask

    主要翻译了链接1)的教程,加上一些个人研究,步骤如下: 1) 在openshift.redhat.com申请账号,安装git for windows,然后安装gem install rhc,这些比较容 ...

  4. Java 打印金字塔 or 打印带数字的金字塔 (Java 学习中的小记录)

    Java 打印金字塔 or 打印带数字的金字塔 (Java 学习中的小记录) 作者:王可利(Star·星星) 效果图: 代码如下: class Star8 { public static void m ...

  5. Linux环境PostgreSQL源码编译安装

    Linux环境PostgreSQL源码编译安装 Linux版本: Red Hat 6.4 PostgreSQL版本: postgresql-9.3.2.tar.gz 数据存放目录: /var/post ...

  6. chkconfig 命令详解

    chkconfig命令主要用来更新(启动或停止)和查询系统服务的运行级信息.谨记chkconfig不是立即自动禁止或激活一个服务,它只是简单的改变了符号连接. 使用语法: chkconfig [--a ...

  7. 记录bigdesk中ElasticSearch的性能参数

    定时采集bigdesk中的Elasticsearch性能参数,并保存到数据库或ELK,以便于进行长期监控. 基于python脚本实现,脚本如下: #coding=gbk import httplibi ...

  8. Linux下如何使CP命令不提示覆盖

    在Linux下使用CP命令,经常会提示是否覆盖,如果是太批量的文件覆盖,老是这么提示,会很烦的.那如何解决这个问题呢? 我们先来看一下原因吧! 一般我们使用的命令是cp -rf sourcefile ...

  9. com.Goods.ForEach

    com.Goods.ForEach(g => { g.TransactionPrice = getUnitPriceByProductId(g.ProductID); g.ExpressMone ...

  10. 读取、添加、删除、修改配置文件 如(Web.config, App.config)

    private Configuration config; public OperateConfig() : this(HttpContext.Current.Request.ApplicationP ...