应用实例: 准备一个txt文件 import jieba txt = open("三国演义.txt","r", encoding = 'gbk',errors='ignore').read() #读取已存好的txt文档 words = jieba.lcut(txt) #进行分词 counts = { ...
分类:
编程语言 时间:
2020-02-09 16:33:19
阅读次数:
84
Link class Solution { public: int ladderLength(string beginWord, string endWord, vector<string>& wordList) { unordered_set<string> words; for(auto &s: ...
分类:
其他好文 时间:
2020-02-09 11:19:33
阅读次数:
67
数据的交换输出 题目分析: 找到最小值,然后与第一个换位置 代码: #include<iostream> using namespace std; int main() { int n; int a[101]; while (cin >> n&&n) { int i,t, min = 99999; ...
分类:
其他好文 时间:
2020-02-08 10:15:34
阅读次数:
74
水仙花数 题目分析: 水仙花数也被称为超完全数字不变数(pluperfect digital invariant, PPDI)、自恋数、自幂数、阿姆斯壮数或阿姆斯特朗数(Armstrong number),水仙花数是指一个 3 位数,它的每个位上的数字的 3次幂之和等于它本身(例如:1^3 + 5^ ...
分类:
其他好文 时间:
2020-02-08 09:46:05
阅读次数:
65
蟠桃记 题目分析: 很普通的一道函数题,利用所给的条件,进行过程的模拟,构造出一个函数 代码: #include<iostream> using namespace std; int fun(int m) { int sum = 0; if (m == 1) { return 1; } else{ ...
分类:
其他好文 时间:
2020-02-08 09:37:27
阅读次数:
48
素数判定 题目分析: 构造一个判断素数的函数fun,利用fun函数判断区间内的素数。 代码: #include <iostream> #include <math.h> #define fun(n) n*n + n + 41 using namespace std; int prime(int n) ...
分类:
其他好文 时间:
2020-02-08 09:35:06
阅读次数:
74
字符串统计 题目分析: 录入字符串,判断数字有多少个,累加保存。 代码: #include<iostream> using namespace std; int main() { char a[100001]; int n; while (cin >> n&&n) { while (n--) { g ...
分类:
其他好文 时间:
2020-02-08 09:29:13
阅读次数:
51
多项式求和 题目分析: 一道经典的入门算法题,利用for循环以及-1的累乘,进行计算,代码如下 代码: #include<iostream> using namespace std; int main(){ int i, n; int t = 1; int cnt; double sum, num; ...
分类:
其他好文 时间:
2020-02-08 09:18:56
阅读次数:
48
#include<iostream> #include<algorithm> #include<cstring> using namespace std; const int maxn=110010; char t[maxn],s[maxn*3]; int p[maxn*3],lens; void ...
分类:
其他好文 时间:
2020-02-08 00:45:03
阅读次数:
77
题目:http://acm.hdu.edu.cn/showproblem.php?pid=2085import java.util.Scanner;public class 核反应堆2085 { public static void main(String[] args) { Scanner inp ...
分类:
其他好文 时间:
2020-02-08 00:20:25
阅读次数:
62