【CS Round #43 A】Expected Dice
【链接】https://csacademy.com/contest/round-43/task/expected-dice/
【题意】
【题解】
【错的次数】
【反思】
【代码】
#include<bits/stdc++.h> using namespace std; int a[10],b[10],c[40],num=0; int main()
{
for(int i=1;i<=6;i++)
{
cin>>a[i];
}
for(int i=1;i<=6;i++)
{
cin>>b[i];
}
for(int i=1;i<=6;i++)
{
for(int j=1;j<=6;j++)
{
num++;
c[num]=a[i]+b[j];
} }
sort(c+1,c+1+num);
int numx,cnt=0;
for(int i=1;i<=num;i++)
{
int j=i;
while(c[i]==c[j]&&j+1<=num)
{
j++;
int temp=j-i+1;
if(temp>cnt)
{
cnt=temp;
numx=c[i];
} }
}
cout<<numx<<endl; return 0;
}
【CS Round #43 A】Expected Dice的更多相关文章
- 【CS Round #43 E】Coprime Pairs
[链接]点击打开链接 [题意] 让你选择n个数字,组成一个数组,使得这n个数字中恰好有k对,它们是互质的. [题解] 我们可以先找出前n个质数,那么接下来的问题就转化为,凑出rest = n*(n-1 ...
- 【CS Round #43 D】Bad Triplet
[链接]点击打开链接 [题意] 给你n个点m条边的无权无向联通图; 让你找3个点A,B,C 使得A->B=B->C=A->C 这里X->Y表示点X到点Y的最短路长度. [题解] ...
- 【CS Round #43 C】Rectangle Partition
[链接]点击打开链接 [题意] 有一辆火车,它的长度为L,然后假设这辆车现在随机可能地出现在0..D之间,然后假设它已经耗光了油. 问你它需要走的期望距离是多少. 这里要走的距离指的是车里最近的加油站 ...
- 【CS Round #43 B】Rectangle Partition
[链接]https://csacademy.com/contest/round-43/task/rectangle-partition/ [题意] 水题 [题解] 横着过去,把相邻的边的宽记录下来. ...
- 【CS round 34】Minimize Max Diff
[题目链接]:https://csacademy.com/contest/round-34/task/minimize-max-diff/ [题意] 给你n个数字; 数组按顺序不下降; 让你删掉k个数 ...
- 【CS Round 34】Max Or Subarray
[题目链接]:https://csacademy.com/contest/round-34/summary/ [题意] 让你找一个最短的连续子串; 使得这个子串里面所有数字or起来最大; [题解] 对 ...
- 【CS Round #36 (Div. 2 only) A】Bicycle Rental
[题目链接]:https://csacademy.com/contest/round-36/task/bicycle-rental/ [题意] 让你从n辆车中选一辆车; 每一辆车有3个属性 1.到达车 ...
- 【CS Round #37 (Div. 2 only) D】Reconstruct Graph
[Link]:https://csacademy.com/contest/round-37/task/reconstruct-graph/statement/ [Description] 给你一张图; ...
- 【CS Round #37 (Div. 2 only) B】Group Split
[Link]:https://csacademy.com/contest/round-37/task/group-split/ [Description] 让你把一个数分成两个数a.b的和; (a,b ...
随机推荐
- 安卓https
http://www.tuicool.com/articles/NrmE3e http://blog.csdn.net/guestcode/article/details/50194357 http: ...
- 使用python创建cocos2d-x项目
已准备条件: 已安装vs2012,已下载cocos2d-x sdk 2.2.3包. 旧版本号使用包里面的模板创建项目,如今新的包,使用python 来创建 1.下载安装 python https ...
- C#最简单的登录Web服务
因为演示程序,所以有下面问题: 1.password是明码传输. 本文在 C#建立最简单的web服务,无需IIS 的基础上完毕. 详细步骤: 一.RequestProcessor添加变量mLogi ...
- 【BUG】"main" prio=5 tid=1 RUNNABLE
载入超大效果图导致内存不足(GC/ANR) 06-30 11:42:56.624: D/dalvikvm(16264): GC_CONCURRENT freed 1982K, 7% free 4537 ...
- Docs-->.NET-->API reference-->System.Web.UI-->Control-->Methods-->FindControl
https://docs.microsoft.com/en-us/dotnet/api/system.web.ui.control.findcontrol?view=netframework-4.7 ...
- html --- bootstrap 框架 (栅格系统布局)
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- POJ 3049 DFS
思路:暴搜 //By SiriusRen #include <cstdio> #include <iostream> #include <algorithm> us ...
- Kinect 开发 —— 语音识别(下)
使用定向麦克风进行波束追踪 (Beam Tracking for a Directional Microphone) 可以使用这4个麦克风来模拟定向麦克风产生的效果,这个过程称之为波束追踪(beam ...
- BZOJ1814: Ural 1519 Formula 1(插头Dp)
Description Regardless of the fact, that Vologda could not get rights to hold the Winter Olympic gam ...
- chsh---更换登录系统时使用的shell
chsh命令 chsh命令用来更换登录系统时使用的shell.若不指定任何参数与用户名称,则chsh会以应答的方式进行设置. 语法 chsh(选项)(参数) 选项 -s<shell 名称&g ...