- 买铅笔
- 2017-05-18 18:58:09 @
Var
n,i,j,min:integer;
a:array[1..3,1..3] of integer;
Begin
for i:=1 to 3 do
for j:=1 to 3 do a[i,j]:=0;
readln(n);
for i:=1 to 3 do
begin
for j:=1 to 2 do read(a[i,j]);
readln;
end;
for i:=1 to 3 do
if (n mod a[i,1]=0) then a[i,3]:=(n div a[i,1])*a[i,2]
else a[i,3]:=((n div a[i,1])+1)*a[i,2];
if a[1,3]>a[2,3] then
if a[2,3]>a[3,3] then write(a[3,3])
else write(a[2,3])
else
if a[1,3]>a[3,3] then write(a[3,3])
else write(a[1,3]);
readln;
End.
6 条评论
-
2940199916 LV 6 @ 2017-11-04 16:13:15
这两个程序是我写的
-
2017-11-04 16:12:56@
var n,s,min,i,a,b:longint;
begin
read(n);
min:=maxlongint;
for i:=1 to 3 do begin
read(a,b);
s:=n div ab;
if n mod a<>0 then inc(s,b);
if s<min then min:=s;
end;
write(min);
end. -
2017-11-04 16:12:27@
用二维数组太麻烦了
-
2017-11-04 16:11:37@
var n,s,min,i,a,b:longint;
begin
read(n);
min:=maxlongint;
for i:=1 to 3 do begin
read(a,b);
s:=n div ab;
if n mod a<>0 then inc(s,b);
if s<min then min:=s;
end;
write(min);
end. -
2017-05-18 19:06:43@
为什么得出来的值是负的?
-
2017-05-18 19:01:57@
求点明啊!!**为什么会错?QAQ**
- 1
信息
- ID
- 2009
- 难度
- 3
- 分类
- (无)
- 标签
- 递交数
- 1674
- 已通过
- 546
- 通过率
- 33%
- 被复制
- 20
- 上传者