您当前的位置: 首页 > 

先求一个导

暂无认证

  • 1浏览

    0关注

    291博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

牛客寒训营5 G(dfs都不会了,建议/remake)

先求一个导 发布时间:2022-02-11 10:08:24 ,浏览量:1

题目 题意: 给定1-13,每个数至多用4次。从中选出6个数,求有多少种不同的方案。 思路: dfs即可.搜索出一个序列后sort之后扔到set里查重。但是我一手sort,改变了原来的数组,导致回溯的时候出现错误,调了一小时,老废物了。只需要用一个临时数组sort即可。今日首蚌。也可以按照题解的方法进行枚举,比dfs强多了。 时间复杂度: 至少是(6^13 * log(6^13)),不太会算。 代码:

// Problem: 163小孩
// Contest: NowCoder
// URL: https://ac.nowcoder.com/acm/contest/23480/G
// Memory Limit: 524288 MB
// Time Limit: 2000 ms
// 
// Powered by CP Editor (https://cpeditor.org)

#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define OldTomato ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
#define fir(i,a,b) for(int i=a;i            
关注
打赏
1662037414
查看更多评论
0.0393s