点击这里更换您喜欢的皮肤wtboj 首页
请点击这里登入noios   首页 入门 c++讲义 入门教程视频 金牌教程 入门视频 站务 公告 | 题库 记录 竞测 测试 闯关 作业 排名 团队 讨论 | 换肤 | 登入 注册  
News >>   新增功能:各团队管理员可以发布本团队作业了 ()

From sina007
分组
讨论 Discussion
 
p1580
var a:array[0..1000]of integer;
n,i,j,k,s,min:longint;
begin
 assign(input,'p1580.in');
 assign(output,'p1580.out');
 reset(input);
 rewrite(output);
 readln(n);
 min:=maxlongint;
 for i:=1 to n do read(a[i]);
 for i:=1 to n do
 begin
  s:=0;
  for j:=1 to i do
  k:=k+a[j];
  for j:=i+1 to n do
  s:=s+a[j];
  if (k>=s) and (k-s<=min) then min:=k-s;
  if (s>=k) and (s-k<=min) then min:=s-k;
 end;
 write(min);
 close(input);
 close(output);
end.
( )

此主题无回复显示
发布讨论主题 回复讨论主题
Flag
  
题号
  P1580
  其它
通过
  47人
提交
  105次
通过率
  45%
难度
  0
提交 讨论 题解
 Copyright wtboj © 2005-2006. www.wutuobang.date Powered by wtboj 关于 联系 帮助
 wtboj Information ---- Total Users : 1242 | Online Users / Processes : 0 / 54 | Processed Time : 424 ms | Server Time : 2025/4/27 3:12:54