0%

热身赛

A.三玖天下第一

题目链接: https://hpuoj.com/contest/18/problem/A/
思路: 很水的一道题, $map$ 统计出现次数最多的数字,判断一下输出就行了.
代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
map<char,int>M;
cin>>s;
int ans=0;
for(int i=0;i<s.length();i++)
M[s[i]]++;
for(int i='0';i<='9';i++)
if(M[i]>M[ans])ans=i;
if(ans=='0')cout<<"Five equal parts."<<endl;
else if(ans=='1')cout<<"One flower gathers people."<<endl;
else if(ans=='2')cout<<"The second is very color."<<endl;
else if(ans=='3')cout<<"San Jiu tian xia di yi!"<<endl;
else if(ans=='4')cout<<"Four leaves kawaii."<<endl;
else cout<<"May daughter."<<endl;
return 0;
}

阅读全文 »

引用

标签插件和 Front-matter 中的标签不同,它们是用于在文章中快速插入特定内容的插件。

阅读全文 »

stack

栈是 后进先出 (Last In Fisrt Out)的一种特殊的线性表。
栈的基本操作如下。

1
2
3
4
5
6
stack<int>S;     //定义栈
S.push(x); //入栈
S.pop(); //出栈
S.top(); //取栈顶元素
S.empty(); //判断栈是否为空
S.size(); //获取栈的大小

阅读全文 »

Description

Today is the birthday of SF,so VS gives two strings S1,S2 to SF as a present,which have a big secret.SF is interested in this secret and ask VS how to get it.There are the things that VS tell:
Suffix(S2,i) = S2[i…len].Ni is the times that Suffix(S2,i) occurs in S1 and Li is the length of Suffix(S2,i).Then the secret is the sum of the product of Ni and Li.
Now SF wants you to help him find the secret.The answer may be very large, so the answer should mod 1000000007.

阅读全文 »

二叉树的遍历

以下为数据结构作业
如有错误,请指出,谢谢!

阅读全文 »