摘要: 题目分类里说这题是hash,我用深搜加剪枝水过~~不过这道题还真算得上一道好题,思路很多,可以用HASH,题目数据再加强一点就更好了深搜代码如下:/* * hdu1496/linux.c * Created on: 2011-8-5 * Author : ben */#include <stdio.h>#include <stdlib.h>#include <string.h>#include <math.h>void work();int main() {#ifndef ONLINE_JUDGE freopen("data.in&qu 阅读全文
posted @ 2011-08-05 15:44 moonbay 阅读(185) 评论(0) 推荐(0) 编辑
摘要: OJ上分类里说这题是HASH,我用JAVA的TreeSet水过~import java.util.Scanner;import java.util.TreeSet;public class Main { public static int work(String str, int N) { int len = str.length(); if(N >= len) { return 1; } TreeSet<String> ts = new TreeSet<String>(); ts.clear(); int ans = 0; for(int i = 0; i + 阅读全文
posted @ 2011-08-05 12:18 moonbay 阅读(165) 评论(0) 推荐(0) 编辑