当前位置:网站首页>(counting class +dp) acwing 900 Integer partition
(counting class +dp) acwing 900 Integer partition
2022-06-11 23:35:00 【Age worry】
900. Integer partition
Topic link https://www.acwing.com/problem/content/902/
subject :
Method :f[i][j] It means that 1~i To piece together j.f[i][j]=f[i-1][j]+f[i][j-i]
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
const int mod=1e9+7;
int f[1010][1010];
//f[i][j]=f[i-1][j]+f[i][j-i];
int main(){
int n;
cin>>n;
for(int i=1;i<=n;i++) f[i][0]=1;
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
if(j>=i)
f[i][j]=(f[i-1][j]+f[i][j-i])%mod;
else
f[i][j]=f[i-1][j];
}
}
cout<<f[n][n];
return 0;
}
边栏推荐
- Implementation scheme of iteration and combination pattern for general tree structure
- MySQL some simple commands
- 2022 safety officer-b certificate theoretical question bank and simulation test
- Flex flexible layout tutorial and understanding of the main axis cross axis: Grammar
- 直播预告|FeatureStore Meetup V3 重磅来袭!
- sonarqube介绍和安装步骤
- [C language] data type storage, original code, inverse code and complement code
- Introduction aux bases de SOLR
- 05 classification learning notes lihongyi's in-depth study 2021
- [day3 literature intensive reading] Oriental time and space interaction in tau and kappa effects
猜你喜欢

Method for WiFi wireless transmission module to access cloud platform using esp8266 chip scheme

Jetpack架构组件学习(3)——Activity Results API使用

CVPR 2022 | 元学习在图像回归任务的表现

Fonctionnement de la plate - forme d'examen de simulation pour les agents de sécurité - Questions d'examen de certificat a en 2022

2022年安全员-B证理论题库及模拟考试

一文读懂Logstash原理

Zigbee3.0 wireless packet capturing installation method based on e18-2g4u04b

2022 safety officer-a certificate test question simulation test platform operation

Wake up wrist - neural network and deep learning (tensorflow application) updating

2022年低压电工上岗证题目及在线模拟考试
随机推荐
Are you still struggling with the gold content of PMP
Lake Shore - supertran VP continuous flow cryogenic thermostat system
Handwritten simple promise
require. context
Postgresql10 process
Si4432 RF chip scheme typical application of data transmission of wireless communication module of Internet of things
05 classification learning notes lihongyi's in-depth study 2021
[Day9 literature extensive reading] on the (a) symmetry between the perception of time and space in large-scale environments
The latest "capsule Network Overview" paper of imperial technology, etc., 29 pages of PDF, expounds the concept, method and application of capsule
GMN of AI medicine article interpretation
Jetpack architecture component learning (3) -- activity results API usage
2022 safety officer-b certificate theoretical question bank and simulation test
Figure overview of neural network
Unity3d C#开发微信小游戏音频/音效播放问题解决过程分享
Analysis on the market prospect of smart home based on ZigBee protocol wireless module
2022年高处安装、维护、拆除操作证考试题库模拟考试平台操作
Two way leading circular linked list (C language)
直播预告|FeatureStore Meetup V3 重磅来袭!
【BBC learningenglish】with Tango
Solr之基礎講解入門