博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
hdu-超级密码(BFS)
阅读量:4286 次
发布时间:2019-05-27

本文共 659 字,大约阅读时间需要 2 分钟。

题目链接:

学了c++感觉有了用武之地用string存储字符串,感觉很方便;

题意:给你m个数字用任意数字组合成n的最小倍数,此题用到大数取余的方法以及同余定理;简单的bfs;

#include
#include
#include
#include
#include
using namespace std;bool vis[5005];int a[20];int T,n,c,m;struct node{ int step,mod; string str;}p,q;char _char(int ss){ if(ss>=0&&ss<=9) return ss+'0'; if(ss>=10&&ss<=15) return ss-10+'A';}void bfs(){ queue
Q; for(int i=0;i
=500) continue ; for(int i=0;i
='0'&&str1[0]<='9') a[i]=str1[0]-'0'; else a[i]=str1[0]+10-'A'; } sort(a,a+m); if(n==0) { printf(a[0]==0?"0\n":"give me the bomb please\n");continue; } memset(vis,false,sizeof(vis)); bfs(); }}

转载地址:http://musgi.baihongyu.com/

你可能感兴趣的文章
查看当前Git工具的版本
查看>>
AngularJS路由之ui-router(三)
查看>>
Sublime Text插件之HTML-CSS-JS Prettify
查看>>
Sublime Text插件之JavaScript Completions
查看>>
C#编码规范整理
查看>>
C#Nullable<T>可空的值类型,C#中的?使用整理
查看>>
EntityFramework中JSON序列化循环引用----JavaScriptSerializer
查看>>
EntiryFramework中事务操作实例
查看>>
删除github上的远程分支
查看>>
Visual Studio Code 1.8 发布
查看>>
SQL Server Management Studio 2016 (SSMS)
查看>>
EF中Sum()异常:到值类型“System.Decimal”的强制转换失败,因为具体化值为 null。
查看>>
Visual Studio Code插件之Atom One Dark Syntax Theme
查看>>
EntiryFramework中事务操作(二)TransactionScope
查看>>
EF获取非跟踪数据之DBSet.AsNoTracking()
查看>>
关于EF6.0整理
查看>>
C# using 关键字使用整理
查看>>
EF日期格式筛选_EF常用日期筛选逻辑整理
查看>>
EF日期筛选异常:SqlServer.DATEDIFF”函数的 DATEPART 参数必须是文字字符串。
查看>>
C# 托管资源 与 非托管资源
查看>>