题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4850

代码如下:

 #include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <sstream>
#include <algorithm>
using namespace std;
#define pb push_back
#define mp make_pair
#define ms(a, b) memset((a), (b), sizeof(a))
#define eps 0.0000001
typedef long long LL;
const int INF = 2e9;
const LL LNF = 9e18;
const int mod = 1e9+;
const int maxn = ***;
int a[maxn+];
int vis[][][][]; void solve()
{
a[] = a[] = a[] = ;
for(int i = ; i<maxn+; i++)
{
for(int j = ; j>=; j--)
{
if(vis[a[i-]][a[i-]][a[i-]][j]==)
{
vis[a[i-]][a[i-]][a[i-]][j] = ;
a[i] = j;
break;
}
}
}
} int main()
{
int n;
solve();
while(scanf("%d",&n)!=EOF)
{
if(n>maxn+)
printf("Impossible");
else
for(int i = ; i<n; i++)
printf("%c",a[i]+'a');
putchar('\n');
}
}

HDU4850 Wow! Such String! —— 字符串构造的更多相关文章

  1. HDU-4850 Wow! Such String! (构造)

    Problem Description Recently, doge starts to get interested in a strange problem: whether there exis ...

  2. hdu 4850 Wow! Such String! 欧拉回路

    作者:jostree 转载请注明出处 http://www.cnblogs.com/jostree/p/4080264.html 题目链接:hdu 4850 Wow! Such String! 欧拉回 ...

  3. Delphi的字符(Char),字符串(String),字符串指针(PChar),字符数组arrayofchar(来自http://delphi.cjcsoft.net/论坛)

    Delphi有三种类型的字符: AnsiChar这是标准的1字节的ANSI字符,程序员都对它比较熟悉. WideChar这是2字节的Unicode字符. Char在目前相当于AnsiChar,但在De ...

  4. String字符串类总结

    object类 int hashCode() Object定义的hashCode方法能为不同对象返回不同的整数.实际上是把JVM给对象分配的地址转化为整数,确保了逻辑上的唯一性.而转化的散列算法,可能 ...

  5. HDU 4850 Wow! Such String!(欧拉道路)

    HDU 4850 Wow! Such String! 题目链接 题意:求50W内的字符串.要求长度大于等于4的子串,仅仅出现一次 思路:须要推理.考虑4个字母的字符串,一共同拥有26^4种,这些由这些 ...

  6. java中String字符串

    一.定义String字符串 String字符串和char字符不同,char使用单引号,只能表示一个字符,字符串就是一段文本.String是个类.这个类使用final修饰,所以这个类是不可以继承扩充和修 ...

  7. String字符串相关操作

    .length 字符串长度.equals 比较字符串.equalIgnoreCase 比较字符串不区别大小写.charAt 获取字符串指定下标位置的字符.contains 判断字符串内是否包含某字符串 ...

  8. String字符串创建方法

    String字符串的创建方法我们总结为3+1,3是一共有3种构造方法,1是有一种特殊的创建方法. 首先来看3种构造方法: 1.new String()  无参构造 用该方法创建的字符串是一个空字符串, ...

  9. 【超值分享】为何写服务器程序需要自己管理内存,从改造std::string字符串操作说起。。。

    服务器程序为何要进行内存管理,管中窥豹,让我们从string字符串的操作说起...... new/delete是用于c++中的动态内存管理函数,而malloc/free在c++和c中都可以使用,本质上 ...

随机推荐

  1. boost::function和boost::bind 介绍

    一. boost::function介绍 原文:http://www.cnblogs.com/sld666666/archive/2010/12/16/1907591.html 本片文章主要介绍boo ...

  2. 2017 [六省联考] T2 相逢是问候

    4869: [Shoi2017]相逢是问候 Time Limit: 40 Sec  Memory Limit: 512 MBSubmit: 1205  Solved: 409[Submit][Stat ...

  3. Codeforces Round #295 (Div. 1) C. Pluses everywhere

    昨天ZZD大神邀请我做一道题,说这题很有趣啊. 哇,然后我被虐了. Orz ZZD 题目大意: 你有一个长度为n的'0-9'串,你要在其中加入k个'+'号,每种方案就会形成一个算式,算式算出来的值记做 ...

  4. Leetcode总结之Tree

    package Tree; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; imp ...

  5. Java创建和解析Json数据方法(四)——json-lib包的使用

    (四)json-lib包的使用         既然json-lib包比org.json包重量级,那么json-lib包肯定有很多org.json包没有的类和方法,这篇笔记简单记录json-lib包中 ...

  6. android studio 在线更新android sdk,遇到无法Fetching https://dl-ssl.google.com/...的解决方案

    最近实在受不了eclipse的“迟钝”,准备入手Android studio开发环境,但是貌似不太顺利,成功安装了Android studio,在线更新Android adk的时候,总是遇到如下错误: ...

  7. 3.【nuxt起步】-下面以一个SPA单页程序为例子

    spa:single page applcation 1.components目录新建header.vue,footer.vue Header.vue Footer.vue Pages/index.v ...

  8. 数据结构与算法系列----AC自己主动机

    一:概念 首先简要介绍一下AC自己主动机:Aho-Corasick automation,该算法在1975年产生于贝尔实验室,是著名的多模匹配算法之中的一个.一个常见的样例就是给出n个单词,再给出一段 ...

  9. 《UNIX-Shell编程24学时教程》读书笔记Chap1,2 Shell基础,脚本基础

    Chap1 Shell基础 知道该使用哪种命令是依赖于经验的.----惟手熟尔. 1.1 什么是命令 其实知道这些名词好像也没什么帮助,嘻嘻 1.2 什么是Shell 不同用户不同的提示符:不同的环境 ...

  10. C++字符串操作二

    #include <iostream> #include <assert.h> using namespace std; //模拟实现strcmp函数. bool my_str ...