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. java之spring mvc之数据处理

    1. 页面中数据提交到 Controller 中如何处理 a) 如果自定义 Controller 是实现 spring 的 Controller 的接口,那么可以通过 HttpServletReque ...

  2. 在Java中如何设置一个定时任务,在每天的一个时间点自动执行一个特定的程序

    Quartz定时机制 首先导入jar包到程序内 quartz-all-1.6.0.jar 然后创建一个XML TimeConfig.xml 名字可以自己定义 <?xml version=&quo ...

  3. 用StatSVN统计svn项目中每人代码提交量

    用StatSVN统计SVN服务器项目的代码量 下载并安装SVN统计工具StatSVN 1)下载地址:sourceforge.net/projects/statsvn/ 2)解压压缩包,到一个目录,如D ...

  4. IDEA中调试时F8,F7快捷键失效

    idea中调试时F8,F7快捷键失效 原因:相关软件的快捷键占用了F8,F7,如我的有道词典占用F8了这个快捷键,导致idea调试时不能使用F8,改变有道词典的快捷键即可.

  5. webpack-dev-server提示css模块解析失败,但已经装了css-loader

    版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明.本文链接:https://blog.csdn.net/a117616/article/detai ...

  6. Java 之 Response 文件下载案例

    文件下载需求: 1. 页面显示超链接 2. 点击超链接后弹出下载提示框 3. 完成图片文件下载 分析过程: 1. 超链接指向的资源如果能够被浏览器解析,则在浏览器中展示,如果不能解析,则弹出下载提示框 ...

  7. Flask项目初始化

    数据库实现命令初始化 1.实现命令主脚本 # coding=utf-8 from functools import wraps from getpass import getpass import s ...

  8. LeetCode刷题:Reverse Words in a String(翻转字符串中的单词)

    题目 Given an input string, reverse the string word by word. For example, Given s = "the sky is b ...

  9. 10分钟学会js处理json常用方法

    一.json定义 JSON ( JavaScript Object Notation) ,它是一串字符串 只不过元素会使用特定的符号标注. {} 双括号表示对象 [] 中括号表示数组 "&q ...

  10. 【方法整理】Oracle 获取trace跟踪文件名的几种常用方式

    [方法整理]Oracle 获取trace跟踪文件名的几种常用方式 1  BLOG文档结构图     2  前言部分 2.1  导读和注意事项 各位技术爱好者,看完本文后,你可以掌握如下的技能,也可以学 ...