A. The Fair Nut and Elevator

好笨啊QAQ。

暴力枚举的题,连分类都不用。

从电梯初始位置到第一层、人到第一层、间隔的层数,往返路程。

#include <bits/stdc++.h>

using namespace std;

int a[105];

int main()
{
int n;
while(~scanf("%d",&n))
{
int Min = 0x3ffffff;
int ans = 0;
for(int i = 1; i <= n; i ++)
{
scanf("%d", &a[i]);
}
for(int i = 1; i <= n; i ++)
{
ans = 0;
for(int j = 1; j <= n; j ++)
{
ans += (abs(j - i) + abs(j - 1) + abs(i - 1)) * a[j] * 2;
}
// cout << ans<< endl;
Min = min(ans,Min);
}
printf("%d\n",Min);
}
return 0;
}

A. The Fair Nut and Elevator (Codeforces Round #526 (Div. 2))的更多相关文章

  1. 【CodeForces】841D. Leha and another game about graph(Codeforces Round #429 (Div. 2))

    [题意]给定n个点和m条无向边(有重边无自环),每个点有权值di=-1,0,1,要求仅保留一些边使得所有点i满足:di=-1或degree%2=di,输出任意方案. [算法]数学+搜索 [题解] 最关 ...

  2. B. Ohana Cleans Up(Codeforces Round #309 (Div. 2))

    B. Ohana Cleans Up   Ohana Matsumae is trying to clean a room, which is divided up into an n by n gr ...

  3. B. The Number of Products(Codeforces Round #585 (Div. 2))

    本题地址: https://codeforces.com/contest/1215/problem/B 本场比赛A题题解:https://www.cnblogs.com/liyexin/p/11535 ...

  4. 【CodeForces】841C. Leha and Function(Codeforces Round #429 (Div. 2))

    [题意]定义函数F(n,k)为1~n的集合中选择k个数字,其中最小数字的期望. 给定两个数字集A,B,A中任意数字>=B中任意数字,要求重组A使得对于i=1~n,sigma(F(Ai,Bi))最 ...

  5. D. Zero Quantity Maximization ( Codeforces Round #544 (Div. 3) )

    题目链接 参考题解 题意: 给你 整形数组a 和 整形数组b ,要你c[i] = d * a[i] + b[i], 求  在c[i]=0的时候  相同的d的数量 最多能有几个. 思路: 1. 首先打开 ...

  6. Vus the Cossack and Strings(Codeforces Round #571 (Div. 2))(大佬的位运算实在是太强了!)

    C. Vus the Cossack and Strings Vus the Cossack has two binary strings, that is, strings that consist ...

  7. CodeForces 360E Levko and Game(Codeforces Round #210 (Div. 1))

    题意:有一些无向边m条权值是给定的k条权值在[l,r]区间可以由你来定,一个点s1 出发一个从s2出发  问s1 出发的能不能先打到f 思路:最短路. 首先检测能不能赢 在更新的时候  如果对于一条边 ...

  8. 贪心+构造( Codeforces Round #344 (Div. 2))

    题目:Report 题意:有两种操作: 1)t = 1,前r个数字按升序排列:   2)t = 2,前r个数字按降序排列: 求执行m次操作后的排列顺序. #include <iostream&g ...

  9. A. Kyoya and Photobooks(Codeforces Round #309 (Div. 2))

    A. Kyoya and Photobooks   Kyoya Ootori is selling photobooks of the Ouran High School Host Club. He ...

随机推荐

  1. 3. ABP .NETCore 添加企业微信第三方登录

    1.企业微信登录步骤 1.获取企业微信Token 官方文档:https://work.weixin.qq.com/api/doc#90000/90135/91039 2.通过Token 与前端传的Co ...

  2. Tomcat6项目移到Tomcat7 提示 404 解决方案

    一个项目在Tomcat6可以运行和正常访问,但是一部署到Tomcat7就提示404错误.那么可以通过以下方法解决: 找到项目下面的   WEB-INF  文件夹   用记事本打开  WEB.XML 找 ...

  3. int转换为String,常用的四种方法。

    int i = 100; 方法一:String s1 = i + " "; 方法二:String s2 = String.valueof(i); 方法三(先转换为Integer类型 ...

  4. 一个非常有趣的爬虫小练习带ocr识别的

    有个小的想法,想找一找 形近字 .百度一搜索,百度文库有一个,收费4元.而且我觉得字数不是太多.想自己弄一个,于是找到了 这个网站 http://www.fantiz5.com/xingjinzi/ ...

  5. Django:RestFramework之-------渲染器

    12.渲染器 from rest_framework.renderers import JSONRenderer,BrowsableAPIRenderer,AdminRenderer class Te ...

  6. CentOS 下运行.net Core程序

    系统: 阿里云的默认 CentOS 7.5 镜像 项目环境:.Net Core 2.2 一.安装.Net Core的运行环境 第一步,如果是一台新的服务器,可以升级一下系统的基础软件.如果没有必要也可 ...

  7. Mac 指令

    Mac 展示隐藏目录 // 设置隐藏文件不可见 defaults write com.apple.finder AppleShowAllFiles FALSE // 设置隐藏文件可见 defaults ...

  8. 【RAC】 RAC For W2K8R2 安装--安装过程中碰到的问题(九)

    [RAC] RAC For W2K8R2 安装--安装过程中碰到的问题(九) 一.1  BLOG文档结构图 一.2  前言部分 一.2.1  导读 各位技术爱好者,看完本文后,你可以掌握如下的技能,也 ...

  9. ubuntu 下 VNC Viewer 通过网线连接树莓派的网络设置

    1 本机环境 Ubuntu 19.10 Raspberry 3B+ (Raspbian.开启了 vnc 服务) 2 Ubuntu 网络设置 1. Identity 下选择 Mac Address(如: ...

  10. WSL quick overview

    简介 WSL,是Windows Subsystem for Linux的缩写,字面意义上理解就是WIndows下的Linux子系统.WSL 由Microsoft Windows内核团队创建,目前如果最 ...