-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2ab8da2
commit ba4c8c0
Showing
1 changed file
with
36 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,47 @@ | ||
记票统计 | ||
参与人数:5时间限制:1秒空间限制:32768K | ||
通过比例:36.36% | ||
最佳记录:0 ms|8552K (来自 Daniel_nowcoder) | ||
算法知识视频讲解 | ||
题目描述 | ||
|
||
请实现接口: | ||
unsigned int AddCandidate (char* pCandidateName); | ||
功能:设置候选人姓名 | ||
输入: char* pCandidateName 候选人姓名 | ||
输出:无 | ||
返回:输入值非法返回0,已经添加过返回0 ,添加成功返回1 | ||
|
||
Void Vote(char* pCandidateName); | ||
功能:投票 | ||
输入: char* pCandidateName 候选人姓名 | ||
输出:无 | ||
返回:无 | ||
|
||
unsigned int GetVoteResult (char* pCandidateName); | ||
功能:获取候选人的票数。如果传入为空指针,返回无效的票数,同时说明本次投票活动结束,释放资源 | ||
输入: char* pCandidateName 候选人姓名。当输入一个空指针时,返回无效的票数 | ||
输出:无 | ||
返回:该候选人获取的票数 | ||
|
||
void Clear() | ||
// 功能:清除投票结果,释放所有资源 | ||
// 输入: | ||
// 输出:无 | ||
// 返回 | ||
题目描述 | ||
请实现接口: | ||
unsigned int AddCandidate (char* pCandidateName); | ||
功能:设置候选人姓名 | ||
输入: char* pCandidateName 候选人姓名 | ||
输出:无 | ||
返回:输入值非法返回0,已经添加过返回0 ,添加成功返回1 | ||
|
||
Void Vote(char* pCandidateName); | ||
功能:投票 | ||
输入: char* pCandidateName 候选人姓名 | ||
输出:无 | ||
返回:无 | ||
|
||
unsigned int GetVoteResult (char* pCandidateName); | ||
功能:获取候选人的票数。如果传入为空指针,返回无效的票数,同时说明本次投票活动结束,释放资源 | ||
输入: char* pCandidateName 候选人姓名。当输入一个空指针时,返回无效的票数 | ||
输出:无 | ||
返回:该候选人获取的票数 | ||
|
||
void Clear() | ||
// 功能:清除投票结果,释放所有资源 | ||
// 输入: | ||
// 输出:无 | ||
// 返回 | ||
|
||
|
||
输入描述: | ||
|
||
输入候选人的人数,第二行输入候选人的名字,第三行输入投票人的人数,第四行输入投票。 | ||
|
||
输入候选人的人数,第二行输入候选人的名字,第三行输入投票人的人数,第四行输入投票。 | ||
|
||
输出描述: | ||
|
||
每行输出候选人的名字和得票数量。 | ||
每行输出候选人的名字和得票数量。 | ||
|
||
输入例子: | ||
|
||
4 | ||
A B C D | ||
8 | ||
A B C D E F G H | ||
4 | ||
A B C D | ||
8 | ||
A B C D E F G H | ||
|
||
输出例子: | ||
|
||
A : 1 | ||
B : 1 | ||
C : 1 | ||
D : 1 | ||
Invalid : 4 | ||
A : 1 | ||
B : 1 | ||
C : 1 | ||
D : 1 | ||
Invalid : 4 |