看完发现文档缺页。。。。。。

3.5  菲波那契数

    vector<int> v;
v.push_back();
v.push_back();
for(int i = ;i < ;++i)
v.push_back(v[i - ] + v[i - ]);

3.14  01 串 排 序

3.14.1  链接地址
http://acm.zjut.edu.cn/网上第 1204 题
3.14.2  题目内容
将 01 串首先按长度排序,长度相同时,按 1 的个数多少进行排序,1 的个数相同时再 按 ASCII 码值排序。 输入描述:输入数据中含有一些 01 串,01 串的长度不大于 256 个字符。 输出描述:重新排列 01 串的顺序,使得串按题目描述的方式排序。 输入样例
 
10011111

00001101

1010101

1

0

1100
 
输出样例
 
0

1

1100

1010101

00001101

10011111

struct myComp
{
bool operator ()(const string &a, const string &b)
{
if(a.size() != b.size())
return a.size() < b.size();
int numa = count(a.begin(), a.end(), '');
int numb = count(b.begin(), b.end(), '');
if(numa != numb)
return numa < numb;
return a < b;
}
}; int main()
{
multiset<string, myComp> m;
string s;
for(int i = ;i < ;++i)
{
cin >> s;
m.insert(s);
}
multiset<string, myComp> :: iterator it;
for(it = m.begin();it != m.end();++it)
cout << *it << endl;
return ;
}

3.15  排列对称串

3.15.1  链接地址
http://acm.zjut.edu.cn/网上第 1208 题

3.15.2  题目内容
字符串有些是对称的,有些是不对称的,请将那些对称的字符串按从小到大的顺序输 出。字符串先以长度论大小,如果长度相同,再以 ASCII 码值为排序标准。 输入描述:输入数据中含有一些字符串(1≤串长≤256)。 输出描述:根据每个字符串,输出对称的那些串,并且要求按从小到大的顺序输出。 输入样例
 
123321

123454321

123

321

sdfsdfd

121212

\\dd\\
 
输出样例
 
123321

\\dd\\

123454321

bool myComp(string &a, string &b)
{
if(a.size() != b.size())
return a.size() < b.size();
return a < b;
} int main()
{
string s, t;
vector<string> vs;
int i, j;
for(i = ;i < ;++i)
{
cin >> s;
t = s;
reverse(t.begin(), t.end());//反转
if(t == s)
vs.push_back(s);
}
sort(vs.begin(), vs.end(), myComp);
for(i = ;i < ;++i)
cout << vs[i] << endl;
return ;
}
4.4.7  编码
给定一个只包含“A”~“Z”的字符串,我们使用下面的方法给它编码: (1)将子字符串中的 k 个相同字符写成“kX ”,X 是子串中的字符。 (2)如果子串的长度是 1,那么“1”要忽略。
输入描述
第一行包含一个正整数 N(1≤N≤100),代表测试案例的个数。下面 N 行包含 N 个 字符串。每个字符串仅包含“A”~“Z”,且字符串的长度小于 100。
输出描述
对于每个测试案例,输出它的编码在单独一行上。
输入描述
2
ABC
ABBCCC
输出描述
ABC
A2B3C
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <stack>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <deque>
#include <list>
#include <bitset> using namespace std; typedef long long ll;
const int MAXN = ;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + ; int main()
{
string s;
int n;
cin >> n;
while(n--)
{
string p;
cin >> s;
int num = ;
for(int i = ;i < s.size();++i)
{
if(s[i] == s[i - ])
num++;
else
{
if(num != )
p += num + '';
p += s[i - ];
num = ;
}
}
p += num + '';
p += s[s.size() - ];
cout << p << endl;
}
return ;
}

《STL详解》解题报告的更多相关文章

  1. 《MIT 6.828 Homework 2: Shell》解题报告

    Homework 2的网站链接:MIT 6.828 Homework 2: shell 题目 下载sh.c文件,在文件中添加相应代码,以支持以下关于shell的功能: 实现简单shell命令,比如ca ...

  2. 《MIT 6.828 Homework 1: boot xv6》解题报告

    本作业的网站链接:MIT 6.828 Homework 1: boot xv6 问题 Exercise: What is on the stack? While stopped at the abov ...

  3. 《MIT 6.828 Lab1: Booting a PC》实验报告

    <MIT 6.828 Lab1: Booting a PC>实验报告 本实验的网站链接见:Lab 1: Booting a PC. 实验内容 熟悉x86汇编语言.QEMU x86仿真器.P ...

  4. 《MIT 6.828 Lab 1 Exercise 12》实验报告

    本实验的网站链接:MIT 6.828 Lab 1 Exercise 12. 题目 Exercise 12. Modify your stack backtrace function to displa ...

  5. 《MIT 6.828 Lab 1 Exercise 11》实验报告

    本实验的网站链接:MIT 6.828 Lab 1 Exercise 11. 题目 The above exercise should give you the information you need ...

  6. 《MIT 6.828 Lab 1 Exercise 10》实验报告

    本实验的网站链接:MIT 6.828 Lab 1 Exercise 10. 题目 Exercise 10. To become familiar with the C calling conventi ...

  7. 《MIT 6.828 Lab 1 Exercise 8》实验报告

    本实验的网站链接:MIT 6.828 Lab 1 Exercise 8. 题目 Exercise 8. Read through kern/printf.c, lib/printfmt.c, and ...

  8. 《MIT 6.828 Lab 1 Exercise 7》实验报告

    本实验链接:mit 6.828 lab1 Exercise 7. 题目 Exercise 7. Use QEMU and GDB to trace into the JOS kernel and st ...

  9. 《MIT 6.828 Lab 1 Exercise 4》实验报告

    本实验链接:mit 6.828 lab1 Exercise 4. 题目 Exercise 4. Read about programming with pointers in C. The best ...

  10. 《MIT 6.828 Lab 1 Exercise 3》实验报告

    本实验的网站链接:mit 6.828 lab1 Exercise 3. 题目 Exercise 3. Take a look at the lab tools guide, especially th ...

随机推荐

  1. 10.LIKE 操作符

    LIKE 操作符用于在 WHERE 子句中搜索列中的指定模式. LIKE 操作符 LIKE 操作符用于在 WHERE 子句中搜索列中的指定模式. SQL LIKE 操作符语法 SELECT colum ...

  2. p5155 [USACO18DEC]Balance Beam

    传送门 分析 https://www.luogu.org/blog/22112/solution-p5155 代码 #include<bits/stdc++.h> using namesp ...

  3. Logistic Regression 用于预测马是否生病

    1.利用Logistic regression 进行分类的主要思想 根据现有数据对分类边界线建立回归公式,即寻找最佳拟合参数集,然后进行分类. 2.利用梯度下降找出最佳拟合参数 3.代码实现 # -* ...

  4. Python3 使用selenium库登陆知乎并保存cookie为本地文件

    Python3 使用selenium库登陆知乎并保存cookie为本地文件 学习使用selenium库模拟登陆知乎,并将cookie保存为本地文件,然后供以后(requests模块)使用,用selen ...

  5. 《架构师杂志》评述:Scott Guthrie

    发布日期: 2007-03-29 | 更新日期: 2007-03-29   Scott Guthrie 是 Microsoft 开发事业部的总经理.他领导着负责构建 CLR(公共语言运行库).ASP. ...

  6. Adorner的收集

    Adorners Overview https://docs.microsoft.com/en-us/dotnet/framework/wpf/controls/adorners-overview ' ...

  7. Java简单实现AOP,Java通用异常拦截,Java与Lamada

    直接看代码不废话.不懂Lamada直接百度... package test; /** * QQ:1448376744 * @author 花间岛 * */ //控制器 public class Con ...

  8. 使用VS Code开发C++

    1. 参考/转载 vs code进行c/c++开发 VSCode 的第一个C++程序(windows)[更新2018.10.28] 2. C++开发相关插件(扩展商店中直接搜索) 至少要装C/C++. ...

  9. react.js学习之路三

    学习react.js,知识点整理: 1.props和state: props是相对于父级来说,固定的不会改变的内容.一般会先定义一个变量,则在父级中进行引用, var user = "liu ...

  10. kali linux之被动信息收集(dns信息收集,区域传输,字典爆破)

    公开可获取的信息,不与目标系统产生交互,避免留下痕迹 下图来自美军方 pdf链接:http://www.fas.org/irp/doddir/army/atp2-22-9.pdf 信息收集内容(可利用 ...