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

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. Logistic Regression 用于预测马是否生病

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

  2. Python3 使用requests库读取本地保存的cookie文件实现免登录访问

    1.  读取selenium模块保存的本地cookie文件来访问知乎 读取http://www.cnblogs.com/strivepy/p/9233389.html保存的本地cookie来访问知乎的 ...

  3. [原创]编译CLANG时遇到问题的解决办法

    CLANG备忘录: 1.编译时遇到 LINK1123 错误尝试使用其他版本的VS编译,可以有效解决这个问题 2.编译时遇到 Unexpectedfailure executing llvm-build ...

  4. Java基础语法(二)<运算符>

    运算符: 下面的都是相关的练习: 1.键盘录入一个三位整数数,请分别获取该三位数上每一位的数值 import java.util.Scanner; public class Test02 { publ ...

  5. 问渠那得清如许?为有源头活水来。——java面向对象的思想

    20169205 2016-2017-2 <移动平台应用开发实践>第2周学习总结 教材学习内容总结 本次作业要求的部分主要是Java高级语言实现面向对象编程的基本方法,其中所介绍的面向对象 ...

  6. python 测试报告发送邮件

    使用过程成出现的如下错误 smtplib.SMTPDataError: (554, 'DT:SPM 126 smtp5错误解决办法   1.自动化测试中,调用邮件模块自动发送邮件时,运行脚本报错: s ...

  7. 说一下我认识的*nix下的服务器热重启

    步骤: 第一: 收到SIGTERM以后现在的服务器监听socket停止accept 但是并没有停止listen,这个很关键.(所以客户端发起的tcp连接的syn得不到synack,只是继续等待,而不会 ...

  8. 解决eclipse中启动Tomcat成功但是访问不了Tomcat问题

    自己搭建了一个springMVC项目,中间出了一些问题,在排查问题的过程中发现eclipse成功启动了Tomcat,但是在浏览器中输入localhost:8080却给我一个冷冷的404,我以为是Tom ...

  9. cinder create volume的流程(1)

    前提:代码的跟踪,使用的是ocata版本 零.执行cinder create 命令,创建数据卷,打开debug开关 [root@osnode241001 ~]# cinder --debug crea ...

  10. java -jar jar包,运行报错没有主清单和无法加载主类

    jar: 包名(class 文件) META-INF(MANIFEST.MF ) .classpath 1.从eclipse直接导出的jar包: 2.修改MANIFEST.MF文件: