jm.Dev-c++又给我整蒙了。
  • 板块P1515 旅行
  • 楼主peng_cheng
  • 当前回复4
  • 已保存回复4
  • 发布时间2021/9/28 13:11
  • 上次更新2023/11/4 05:28:03
查看原帖
jm.Dev-c++又给我整蒙了。
205320
peng_cheng楼主2021/9/28 13:11

《 这是为什么》

#include<bits/stdc++.h>
using namespace std;
int a, b;
int tot = 13;
int ans = 0;
int a_i[10005] = {990, 1010, 19770, 2030, 2940, 3060, 3930, 4060, 4970, 5030, 5990, 6010, 7000};
void dfs(int k, int hav)
{
	for(int i = hav; i < tot ;i++)
	{
		if(a_i[i] - k >= a && a_i[i] - k <= b)
		{
			ans++;
			dfs(a_i[i], i);
		}
	}
	return;
}
int main()
{
	cin >> a >> b;
	int p, x;
	cin>>p;
	for(int i = 1; i <= p; i++)
	{
		cin>>x;
		a_i[tot] = x;
		tot++;
	}
	sort(a, a + tot);
	dfs(0, 0);
	cout << ans;
	return 0;
}
2021/9/28 13:11
加载中...