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算法写了一个, ...
随机推荐
- Codeforces Round #222 (Div. 1) 博弈 + dp
一般这种要倒着来. #include<bits/stdc++.h> #define LL long long #define fi first #define se second #def ...
- Redis实战配置(三)
程序配置 我们安装好了Redis的系统服务,此时Redis服务已经运行. 现在我们需要让我们的程序能正确读取到Redis服务地址等一系列的配置信息,首先,需要在Web.config文件中添加如下信息: ...
- python元类:type和metaclass
python元类:type和metaclass python中一切皆对象,所以类本身也是对象.类有创建对象的能力,那谁来创建类的呢?答案是type. 1.用tpye函数创建一个类 class A(ob ...
- email 校验
email 校验: javascript: /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/ java: ^([a- ...
- cordova编译crosswalk-webview插件报错的处理办法
一直用得好好的.今天编译cordova失败了.报错如下: :processArmv7DebugManifest :processArmv7DebugResourcesERROR: In FontFam ...
- elementUI 学习入门之 layout 布局
layout 布局 通过基础的 24 分栏,可进行快速布局 基础布局 使用单一分栏创建基础的栅格布局, 通过 span 属性指定每栏的大小 <el-col :span="8" ...
- 《大话设计模式》--UML图
类图分三层: 第一层:类的名称,如果是抽象类,就用斜体显示 第二层:类的特性,通常是字段和属性 第三层:类的操作,通常是方法或行为 接口图:第一行是接口名称,第二行是接口方法 继承:用空心三角形+实线 ...
- CodeForces 785B Anton and Classes
简单判断. 找第一类区间中$R$最大的,以及第二类区间中$L$最小的,判断距离. 找第二类区间中$R$最大的,以及第一类区间中$L$最小的,判断距离. 两种情况取个最大值即可. #include &l ...
- POJ 1597 Function Run Fun
记忆化搜索. #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> ...
- linux 重写rm命令
重写rm命令 replease rm to trash 必须使用root编辑/etc/bashrc vim /etc/bashrc 在最后面增加如下脚本 saferm () { if [ ! -d ...