hdu 4403 简单搜索
思路:分等号左边和右边进行搜索
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#define LL __int64
using namespace std;
char str[];
int n,ans;
void right(LL sum,LL now,int cnt)
{
if(cnt==n)
{
if(sum==now)
ans++;
return ;
}
if(sum==)
return ;
if(sum>=now*+(LL)(str[cnt]-''))
right(sum,now*+(LL)(str[cnt]-''),cnt+);
if(sum>=now)
right(sum-now,str[cnt]-'',cnt+);
return ;
}
void left(LL sum,LL now,int cnt)
{
if(cnt)
right(sum+now,str[cnt]-'',cnt+);
if(cnt==n-)
return ;
if(now)
left(sum,now*+(LL)(str[cnt]-''),cnt+);
left(sum+now,str[cnt]-'',cnt+);
}
int main()
{
int i,j;
while(scanf("%s",&str),str[]!='E')
{
n=strlen(str);
ans=;
left(,,);
printf("%d\n",ans);
}
return ;
}
hdu 4403 简单搜索的更多相关文章
- 搜索入门_简单搜索bfs dfs大杂烩
dfs题大杂烩 棋盘问题 POJ - 1321 和经典的八皇后问题一样. 给你一个棋盘,只有#区域可以放棋子,同时同一行和同一列只能有一个棋子. 问你放k个棋子有多少种方案. 很明显,这是搜索题. ...
- ElasticSearch 5学习(4)——简单搜索笔记
空搜索: GET /_search hits: total 总数 hits 前10条数据 hits 数组中的每个结果都包含_index._type和文档的_id字段,被加入到_source字段中这意味 ...
- nyoj 284 坦克大战 简单搜索
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=284 题意:在一个给定图中,铁墙,河流不可走,砖墙走的话,多花费时间1,问从起点到终点至少 ...
- HDU 2828 DLX搜索
Lamp Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submi ...
- 分布式搜索ElasticSearch构建集群与简单搜索实例应用
分布式搜索ElasticSearch构建集群与简单搜索实例应用 关于ElasticSearch不介绍了,直接说应用. 分布式ElasticSearch集群构建的方法. 1.通过在程序中创建一个嵌入es ...
- solr简单搜索案例
solr简单搜索案例 使用Solr实现电商网站中商品信息搜索功能,可以根据关键字搜索商品信息,根据商品分类.价格过滤搜索结果,也可以根据价格进行排序,实现分页. 架构分为: 1. solr服务器 2. ...
- 和我一起打造个简单搜索之SpringDataElasticSearch入门
网上大多通过 java 操作 es 使用的都是 TransportClient,而介绍使用 SpringDataElasticSearch 的文章相对比较少,笔者也是摸索了许久,接下来本文介绍 Spr ...
- 和我一起打造个简单搜索之SpringDataElasticSearch关键词高亮
前面几篇文章详细讲解了 ElasticSearch 的搭建以及使用 SpringDataElasticSearch 来完成搜索查询,但是搜索一般都会有搜索关键字高亮的功能,今天我们把它给加上. 系列文 ...
- 和我一起打造个简单搜索之Logstash实时同步建立索引
用过 Solr 的朋友都知道,Solr 可以直接在配置文件中配置数据库连接从而完成索引的同步创建,但是 ElasticSearch 本身并不具备这样的功能,那如何建立索引呢?方法其实很多,可以使用 J ...
随机推荐
- PL SQL笔记(三)
loop then .. exit; end if; end loop; select to_char(sysdate, 'YYYY-MM-DD HH24:MI:SS') from dual; sel ...
- VS2015生成64位dll文件
导入自己的源文件,准备生成DLL文件.也可以自己创建. 右键项目,进入属性,修改Configuration Type 为 DLL. 修改为64位,Configureation Manager -> ...
- 不用FTP使用SecureCRT上传下载文件,并解决rz、sz command not found异常
使用SSH终端操作Linux/UNIX时,很多时候需要传一些文件到服务器上,或说从服务器上下载一些文件,这类文件传输动作一般使用FTP即可,但是需要架设FTP Server,每次传输不太方便,还要另外 ...
- 如何提高数据库update更新的速度
不用不知道,一用吓一跳..看下面这条SQL语句 String sql="update cats set name_alias='"+rs.getString(1)+"'w ...
- Hadoop on Mac with IntelliJ IDEA - 9 解决Type mismatch in value from map问题
修改陆喜恒. Hadoop实战(第2版)5.3排序的代码时遇到IO异常. 环境:Mac OS X 10.9.5, IntelliJ IDEA 13.1.5, Hadoop 1.2.1 异常具体信息如下 ...
- linux tar.gz zip 解压缩 压缩命令
http://apps.hi.baidu.com/share/detail/37384818 download ADT link http://dl.google.com/android/ADT-0. ...
- jQuery 动态加载树
本案例中用到了jquery的 tree插件,在本文的附件中可以下载 jsp代码: <%@ page language="java" import="java.uti ...
- cdoj 1150 排名表 拓扑排序
排名表 Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.uestc.edu.cn/#/problem/show/1150 Descrip ...
- [Angular2 Router] Build Angular 2 Navigation with routerLink
Angular 2 navigation is configured using the routerLink directive. The routerLink directive behaves ...
- cocos2d-x android 字体的设置
我们知道 ios 自带的字体 和 android 自带的字体不同 为了使我们开发的游戏中的字体统一 我们就需要自己的字体(包括从mac 拷贝出来的 字体) 从 mac 中 copy 出 Thonbur ...