SRM 212 Div II Level One: YahtzeeScore
题目来源:http://community.topcoder.com/stat?c=problem_statement&pm=1692&rd=5858
比较简单。
代码如下:
#include <iostream>
#include <vector> using namespace std; class YahtzeeScore
{
public:
int maxPoints(vector <int> toss);
}; int YahtzeeScore::maxPoints(vector<int> toss)
{
int i, j;
int size = toss.size();
int maxP = 0;
int sum; for (i = 0; i < size; i++) {
sum = 0;
for (j = 0; j < size; j++) {
if (toss[i] == toss[j]) {
sum += toss[i];
}
}
if (sum > maxP) {
maxP = sum;
}
}
return maxP;
}
SRM 212 Div II Level One: YahtzeeScore的更多相关文章
- SRM 212 Div II Level Two: WinningRecord,Brute Force
题目来源:http://community.topcoder.com/stat?c=problem_statement&pm=3003&rd=5858 比较简单. 代码如下: #inc ...
- SRM 223 Div II Level Two: BlackAndRed,O(N)复杂度
题目来源:http://community.topcoder.com/stat?c=problem_statement&pm=3457&rd=5869 解答分析:http://comm ...
- SRM 207 Div II Level Two: RegularSeason,字符串操作(sstream),多关键字排序(操作符重载)
题目来源:http://community.topcoder.com/stat?c=problem_statement&pm=2866&rd=5853 主要是要对字符串的操作要熟悉,熟 ...
- SRM 577 Div II Level Two: EllysRoomAssignmentsDiv2
题目来源: http://community.topcoder.com/tc?module=ProblemDetail&rd=15497&pm=12521 这个问题要注意的就是只需要直 ...
- SRM 582 Div II Level One: SemiPerfectSquare
题目来源:http://community.topcoder.com/stat?c=problem_statement&pm=12580 比较简单,代码如下: #include <ios ...
- SRM 582 Div II Level Two SpaceWarDiv2
题目来源:http://community.topcoder.com/stat?c=problem_statement&pm=12556 #include <iostream> # ...
- SRM 582 Div II Level Three: ColorTheCells, Brute Force 算法
题目来源:http://community.topcoder.com/stat?c=problem_statement&pm=12581 Burte Force 算法,求解了所有了情况,注意 ...
- SRM 583 Div II Level One:SwappingDigits
题目来源:http://community.topcoder.com/stat?c=problem_statement&pm=12609 #include <iostream> # ...
- SRM 583 Div II Level Three:GameOnABoard,Dijkstra最短路径算法
题目来源:http://community.topcoder.com/stat?c=problem_statement&pm=12556 用Dijkstra实现,之前用Floyd算法写了一个, ...
随机推荐
- 获取对象的key【键】和分别获取数组的key【键】和值
一.先说对象,如何获取key[键]: var obj={ name:"websong", qq:289483936 } 想要获取这个obj对象的键“name”和"qq&q ...
- 【Spark亚太研究院系列丛书】Spark实战高手之路-第2章动手实战Scala第3小节:动手实战Scala函数式编程(2)
3,动手实战Scala中的泛型 泛型泛型类和泛型方法,也就是我们实例化类或者调用方法的时候可以指定其类型,由于Scala的泛型和Java的泛型是一致的,这里不再赘述. 4,动手实战Scala中的隐式转 ...
- Android中由Handler和内部类引起的内存泄漏
原文地址:http://johnnyshieh.github.io/android/2015/09/03/android-handler-memory-leak/ 在Android中我们经常用Hand ...
- 长沙理工大学第十二届ACM大赛-重现赛 G - 跑路ing
题目描述 vigoss18 辞职成功终于逃出了公司,但是没过太久,公司就发现vigoss18 的所作所为,于是派人来把他抓 回去. vigoss18 必须一直跑路,躲避公司的围捕.可以抽象的看成一个有 ...
- 最短路——spfa
适用范围:给定的图存在负权边,这时类似Dijkstra等算法便没有了用武之地,而Bellman-Ford算法的复杂度又过高,SPFA算法便派上用场了. 我们约定有向加权图G不存在负权回路,即最短路径一 ...
- asp.net core集成CAP(分布式事务总线)
一.前言 感谢杨晓东大佬为社区贡献的CAP开源项目,传送门在此:.NET Core 事件总线,分布式事务解决方案:CAP 以及 如何在你的项目中集成 CAP[手把手视频教程],之前也在工作中遇到分布式 ...
- Failed to add VMware DC to zone due to : This DC is being managed by other CloudStack deployment.
1.下载VMware-PowerCLI 2.安装VMware-PowerCLI 安装过程中会重复重启,请确认重启,不要设置稍后手动重启. 3.在开始,菜单中选择 vmware ->VMware ...
- XPath中的text()和string()区别(转)
原文地址 : http://blog.csdn.net/jiangchao858/article/details/63314426 本质区别 text()是一个node test,而string()是 ...
- Codeforces Round #479 (Div. 3)
手速场2333,这群人贼牛逼!手速贼快! A. Wrong Subtraction time limit per test 1 second memory limit per test 256 m ...
- 【期望DP】BZOJ2134- 单选错位
[题目大意] 有n道题,第i道题有ai个选项.一个人把所有的正确答案填到了后面一题上(特殊的,当i=n的时候填到1上),问他期望做对几道题? [思路] 沙茶题……显然每道题的期望是独立的. 对于某道题 ...