题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1015

      题目罗嗦了半天,其实意思很简单,就是给定一个目标值target,再给你一个备选字符串(5~12个字符),要你在这个字符串里选5个出来,满足题中给定的等式,并且你选择的这5个字符组成的字符串必须是所有可能情况中按字典序最大的情况。

      简单分析下就可以看出,就是一个组合问题,问题解的最大规模就是125,就是12*11*10*9*8*7,而最小规模是55,所以应该用枚举法就可以搞定。

HDU1015 Safecracker#include <iostream>
HDU1015 Safecracker#include 
<string>
HDU1015 Safecracker#include 
<vector>
HDU1015 Safecracker
using namespace std;
HDU1015 Safecracker
HDU1015 Safecracker
bool isOk(int v,int w,int x,int y,int z,long int target)

相关文章:

  • 2021-09-16
  • 2021-10-08
  • 2022-12-23
  • 2022-12-23
  • 2021-05-28
  • 2021-05-20
  • 2021-09-08
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-18
  • 2022-12-23
  • 2022-12-23
  • 2021-06-11
  • 2021-09-22
相关资源
相似解决方案