CA Loves GCD
题意
给你n个数,从里面任取几个(至少1个),计算它们的gcd,问你所有可能的取法的gcd之和。
对结果模1e8+7(注意是8)
n<=1000
思路
dp[i][j]表示取前i个数时gcd为j的种数。
取第i个时:dp[i][gcd(a[i],j)] += dp[i-1][j] ;
不取第i个时:dp[i][j] += dp[i-1][j];
对1000内的任意两个数的gcd作预处理,i从0开始。
看!代码
1 |
|
缺失模块。
1、请确保node版本大于6.2
2、在博客根目录(注意不是yilia根目录)执行以下命令:
npm i hexo-generator-json-content --save
3、在根目录_config.yml里添加配置:
jsonContent:
meta: false
pages: false
posts:
title: true
date: true
path: true
text: false
raw: false
content: false
slug: false
updated: false
comments: false
link: false
permalink: false
excerpt: false
categories: false
tags: true