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. mac上使用git命令上传项目工程源码至Github/gitee

    原文连接:(http://www.studyshare.cn/blog/details/1164/0 ) 一.安装git工具 1.官网下载地址:点击下载  安装步骤略,mac安装工具双击拖动即可. 2 ...

  2. DOS之cd命令

    cd命令是改变子目录的命令, 下面是cd命令的常见用法 cd/?可显示帮助信息 cd 返回到当前所在的根目录中 cd.. 返回上一层目录 cd +目录名,进入下一层目录 驱动器:,进入到另一个驱动器 ...

  3. guava使用

    对于Guava Cache本身就不多做介绍了,一个非常好用的本地cache lib,可以完全取代自己手动维护ConcurrentHashMap. 背景 目前需要开发一个接口I,对性能要求有非常高的要求 ...

  4. JavaWeb 之 JSTL 标签

    JSTL 标签库 一.概述 1.概念 JSTL : JavaServer Pages Tag Library  JSP标准标签库. 是由 Apache 组织提供的开源的免费的 jsp 标签. 2.作用 ...

  5. 一些常用的 Emoji 符号(可直接复制)

    表情类

  6. es截取指定的字段返回

    SearchResponse response = client.prepareSearch(index_name).setTypes("lw_devices") .setFrom ...

  7. Mac 环境变量的配置

    1.打开终端. 2.输入命令:sudo vi /etc/paths,然后enter,输入电脑开机密码,继续enter(这个地方的密码不会显示,只要你输入完了就按enter). 3.此时vi编辑器打开了 ...

  8. unittest管理接口用例(数据分离-读取excel)

    1.简单读取 #coding=utf-8 #调用封装好的excel读取公共方法 from python_API.common.ReadExcel import ReadExcel import req ...

  9. 线程中的join方法,与synchronized和wait()和notify()的关系

    什么时候要用join()方法? 1,join方法是Thread类中的方法,主线程执行完start()方法,线程就进入就绪状态,虚拟机最终会执行run方法进入运行状态.此时.主线程跳出start方法往下 ...

  10. NODE简易综合应用服务器搭建

    node搭建简易服务器 querystring和url模板学习地址 querystring&url 1. 目录结构 2. 代码结构 const http = require('http'); ...