1 条题解
-
0
#include <bits/stdc++.h> using namespace std; vector<int> hot={0,990,1010,1970,2030,2940,3060,3930,4060,4970,5030,5990,6010,7000}; int main(){ int a,b,n,x; cin>>a; cin>>b; cin>>n; for(int i=14;i<n+14;i++){ cin>>x; hot.push_back(x); } sort(hot.begin(),hot.end()); int len=hot.size(); vector<int> dp(35,0); //定义dp[i] 为 到达第I个旅馆时,总共的旅行方案 dp[0]=1; for(int i=1;i<len;i++){ for(int j=0;j<i;j++){ if(hot[i] - hot[j] >=a &&hot[i] - hot[j] <= b){ dp[i] +=dp[j]; } } } cout<<dp[13+n]; return 0; }
- 1
信息
- ID
- 421
- 时间
- 1000ms
- 内存
- 64MiB
- 难度
- 6
- 标签
- 递交数
- 41
- 已通过
- 15
- 上传者