1441: Min

Time Limit: 5 Sec  Memory Limit: 64 MB
Submit: 320  Solved: 213
[Submit][Status][Discuss]

Description

给出n个数(A1...An)现求一组整数序列(X1...Xn)使得S=A1*X1+...An*Xn>0,且S的值最小

Input

第一行给出数字N,代表有N个数 下面一行给出N个数

Output

S的最小值

Sample Input

2
4059 -1782

Sample Output

99

HINT

 

Source

 
题解:今天才知道有个很神奇的东西叫做裴蜀定理= =
比如此题中(详见 百度百科——裴蜀定理
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAA0wAAACECAYAAACjzqvzAAAgAElEQVR4Xu2dcWxUR57nv+QmgWTghhyZteGkTfPHgEcDihHc2c5oRXPaw527EByBjoa9PZpbCXuleNKckWh7/0jnpIVGiodmQRoTadeNNAONBIMzRpsmfxyNRouNhEXPkNEYTiM60gjMDVycMTOxk5vk9Lr97Nevq17Ve/3sbvC3/yHxq1f1q8+vXlV936+q3qI//OEPX0PyGx8fx6pVq2SX+XcSIAESIAESIAESIAESIAESeKoJLKJgeqr9y8qRAAmQAAmQAAmQAAmQAAlUQICCqQJ4vJUESIAESIAESIAESIAESODpJkDB9HT7l7UjARIgARIgARIgARIgARKogAAFUwXweCsJkAAJkAAJkAAJkAAJkMDTTYCC6en2L2tHAiRAAiRAAiRAAiRAAiRQAQEKpgrg8VYSIAESIAESIAESIAESIIGnmwAF09PtX9aOBEiABEiABEiABEiABEigAgIUTBXA460kQAIkQAIkQAIkQAIkQAJPNwEKpqfbv6wdCZAACZAACZAACZAACZBABQQomCqAx1tJgARIgARIgARIgARIgASebgIUTE+3f1k7EiABEiABEiABEiABEiCBCggoBdNbHz5bQfbOt77w3CLE/vJbWLdy7sqYM+PLMh5GYlELuo8M4etYs7TYXDKEaC6IeCKGYL0b66bz334W9wfCkN2aSzSgIxNCPJ1ESJn/JIYTHRgO9SHauMSNMa7STmZjaEyMoyMWR1Ra6RySwQ5kGzoQT0Ywh+a4sr2aicdH04jH8winYmieO/dUs4osmwRIgARIgARIgARqnkBVB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PoMPxY1dySMaR6M9vOS5IMB1Fms43l2zGhgPXUbfrLIbT4bJllYZ/s5kM0ukBjI7lcbUAWOOn0Y4pmDQ4MgkJkAAJkAAJkAAJWAhUXTC98Owi/Pi/vVQdp3iMMM25sbkkgh1ZNITDxWVUDZIlVMbOmYwx8R9DWzKOcEFNiX/5gShio2GkYs2FaIbXJXnFI7KvWgqpw9rWMOIlBx24F0zIpxBcvQ/WnI1CjL1bHfE4YiHVEXfmR2rzWLs5hFA4hFBjIxobAqifCR3Z2Uwin8sgm85gIJvBWFsa2Wk+nnycT6Nt9W58MHPzy2jaHkIklkBHs9U3OfRFsmjui6LR3SmbnsziTSRAAiRAAiRAAiRAAt4JVFUwGWIp9h+/hXUrn/VeA95JAhYCk5OAy6P+yY8ESIAESIAESIAESIAEpASUgsk4EpA/EiABEiABEiABEiABEiABEliIBCiYFqLXWWcSIAESIAESIAESIAESIAEtAhRMWpiYiARIgARIgARIgARIgARIYCESoGBaiF5nnUmABEiABEiABEiABEiABLQIUDBpYWIiEiABEiABEiABEiABEiCBhUiAgmkhep11JgESIAESIAESIAESIAES0CJAwaSFiYlIgARIgARIgARIgARIgAQWIgEKpoXoddaZBEiABEiABEiABEiABEhAiwAFkxYmJiIBEiABEiABEiABEiABEliIBCiYFqLXWWcSIAESIAESIAESIAESIAEtAhRMWpiYiARIgARIgARIgARIgARIYCESoGBaiF5nnUmABEiABEiABEiABEiABLQIUDBpYWIiEiABEiABEiABEiABEiCBhUiAgmkhep11JgESIAESIAESIAESIAES0CJAwaSFiYlIgARIgARIgARIgARIgAQWIgEKpoXoddaZBEiABEiABEiABEiABEhAiwAFkxYmJiIBEiABEiABEiABEiABEliIBCiYFqLXWWcSIAESIAESIAESIAESIAEtAhRMWpiYiARIgARIgARIgARIgARIYCESoGBaiF5nnUmABEiABEiABEiABEiABLQIUDBZMG3atAk3btzQAsdEtUtgLv3oJu+X3v45Hh7/ixJQor/ZScrS6Nzrt1eM+qp+qmfGDTOjLDO91/us9qryMJ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s66hYSRAAiRAAiRAAiRAAiRAAtUmQMFUbQ+wfBIgARIgARIgARIgARIggZolQMFUs66hYSRAAiRAAiRAAiRAAiRAAtUmQMFUbQ+wfBIgARIgARIgARIgARIggZolQMFUs66hYSRAAiRAAiRAAiRAAiRAAtUmQMFUbQ+wfBIgARIgARIgARIgARIggZolQMFUs66hYSRAAiRAAiRAAiRAAiRAAtUmQMFUbQ+wfBIgARIgARIgARIgARIggZolQMFUs66hYSRAAiRAAiRAAiRAAiRAAtUmQMFUbQ+wfBIgARIgARIgARIgARIggZolQMFUs66hYSRAAiRAAiRAAiRAAiRAAtUmQMFUbQ+wfBIgARIgARIgARIgARIggZolQMFUs66hYSRAAiRAAiRAAiRAAiRAAtUmQMFUbQ+wfBIgARIgARIgARIgARIggZolQMFUs66hYSRAAiRAAiRAAiRAAiRAAtUmQMFUbQ+wfBIgARIgARIgARIgARIggZol8P8BKndhVLeANc4AAAAASUVORK5CYII=" alt="" />
 
 /**************************************************************
Problem:
User: HansBug
Language: Pascal
Result: Accepted
Time: ms
Memory: kb
****************************************************************/ var
i,j,k,l,m,n:longint;
function gcd(x,y:longint):longint;
var z:longint;
begin
x:=abs(x);y:=abs(y);
while y<> do
begin
z:=x mod y;
x:=y;
y:=z;
end;
exit(x);
end;
begin
readln(n);
read(m);
if n= then
begin
readln;
writeln(m);
readln;
halt;
end;
for i:= to n do
begin
read(j);
m:=gcd(m,j);
end;
readln;
writeln(m);
readln;
end.

1441: Min的更多相关文章

  1. BZOJ 1441: Min(裴蜀定理)

    BZOJ 1441:Min Description 给出n个数(A1...An)现求一组整数序列(X1...Xn)使得S=A1*X1+...An*Xn>0,且S的值最小 Input 第一行给出数 ...

  2. 【BZOJ】1441: Min(裴蜀定理)

    http://www.lydsy.com/JudgeOnline/problem.php?id=1441 这东西竟然还有个名词叫裴蜀定理................ 裸题不说....<初等数 ...

  3. 【BZOJ】1441 Min(数学)

    题目 传送门:QWQ 分析 裴蜀定理. 因为存在 $ a_1 $ $ a_2 $...... $ a_n $的最大公约数为 $ d $,那么必定存在 $ x_1*a_1+x_2*a_2+...x_n* ...

  4. bzoj 1441: Min 裴蜀定理

    题目: 给出\(n\)个数\((A_1, ... ,A_n)\)现求一组整数序列\((X_1, ... X_n)\)使得\(S=A_1*X_1+ ...+ A_n*X_n > 0\),且\(S\ ...

  5. [BZOJ] 1441 Min

    题意:给一堆数ai,求S=Σxiai,使得S最小且为正整数 根据裴蜀定理,一定存在ax+by=gcd(a,b),同理可以推广到n个整数 也就是说,在不考虑正负的情况下,所有数的gcd就是所求 #inc ...

  6. BZOJ 1441: Min exgcd

    根据 $exgcd$ 的定理,这种方程的最小解就是 $gcd$. Code: #include <cstdio> #include <algorithm> using name ...

  7. 【BZOJ-1441】Min 裴蜀定理 + 最大公约数

    1441: Min Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 471  Solved: 314[Submit][Status][Discuss] De ...

  8. BZOJ 1441

    1441: Min Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 467  Solved: 312[Submit][Status][Discuss] De ...

  9. bzoj AC倒序

    Search GO 说明:输入题号直接进入相应题目,如需搜索含数字的题目,请在关键词前加单引号 Problem ID Title Source AC Submit Y 1000 A+B Problem ...

随机推荐

  1. JAVA中获取当前运行的类名,方法名,行数

    JAVA中获取当前运行的类名,方法名,行数 public static String getTraceInfo(){ StringBuffer sb = new StringBuffer(); Sta ...

  2. jQuery 对象与Dom 对象互转

    jQuery 对象与Dom 对象互转: $obj --[i],get(i)-->obj --$(obj)-->$obj; obj--$($(obj))-->$obj,多包装了也是$o ...

  3. 在Winfrom下实现类似百度、Google搜索自能提示功能

    前记:数据源来自页面的一个ComboBox的数据源List<Contract>集合 页面放置一个TextBox(搜索框).ListBox(显示搜索出来的数据),ListBox位置位于Tex ...

  4. iOS网络层设计感想

    App的开发无外乎从网络端获取数据显示在屏幕上,数据做些缓存或者持久化,所以网络层极为重要.原来只是把AFNetwork二次封装了一下,使得调用变得很简单,并没有深层次的考虑一些问题. 前言 参考: ...

  5. SysLog简介和java操作实例

    什么是SysLog syslog协议属于一种主从式协议:syslog发送端会传送出一个小的文字讯息(小于1024字节)到syslog接收端.接收端通常名为“syslogd”.“syslog daemo ...

  6. C#文本框允许使用ctrl+A

    C#文本框中默认是不允许使用全选的.可以通过以下事件完成: private void textBox1_KeyDown(object sender, KeyEventArgs e) { if (e.C ...

  7. Google Guice学习

    学习动力:公司项目使用 官方文档:https://github.com/google/guice/wiki/Motivation 学习阶段:入门 主要部份: 简介 Bindings方式 Scopes设 ...

  8. 网易云直播SDK使用总结

    前言: 最近公司的项目中加入中直播这部分的功能,现在的直播平台真的很多很多,以前在朋友圈看到过这张图片,没办法一次性给大家看,就只能这样截成几张给大家看看.其实按照我自己的看法,现在的直播已经没办法做 ...

  9. Top命名的一些简单用法

    1. Top命令的显示 top 2. 按(Shift + O)是为了选择列进行排序.例如:按a是为了通过PID进行排序.然后按任意键返回主窗口. 3. 显示特定用户的进程. top -u hadoop ...

  10. ubuntu文件目录详细介绍

    /bin 二进制可执行命令 /dev 设备文件(硬盘/光驱等) /etc 系统管理和配置文件 /etc/rc.d 启动的配置文件和脚本 /home 用户主目录,下面会有以登录用户名作为文件夹名的各文件 ...