读入N个数,打印其中的最大数及其位置号
来源:学生作业帮 编辑:神马作文网作业帮 分类:综合作业 时间:2024/10/01 19:27:27
读入N个数,打印其中的最大数及其位置号
用Pascal编程
还有个题目
给定一串整数数列,求出所有的递增和递减子序列的数目,如数列7,2,6,9,8,3,5,2,1可分为(7,2),(2,6,9),(9,8,3,),(3,5),(5,2,1)5个子序列,答案就是5.我们称2,9,3,5为转则元素.
请各位大虾们帮帮忙啦
用Pascal编程
还有个题目
给定一串整数数列,求出所有的递增和递减子序列的数目,如数列7,2,6,9,8,3,5,2,1可分为(7,2),(2,6,9),(9,8,3,),(3,5),(5,2,1)5个子序列,答案就是5.我们称2,9,3,5为转则元素.
请各位大虾们帮帮忙啦
1.
program wt(input,output);
var
max,x,m,n,i:longint;
begin
max:=-maxlongint;
readln(n);
for i:=1 to n do
begin
read(x);
if x>max then begin max:=x;m:=i;end;
end;
writeln(max);
writeln(m);
end.
2.program wt(input,output);
var
i,sum,n:longint;
a:array[0..10000]of longint;
bo:boolean;
begin
readln(n);
for i:=1 to n do
read(a[i]);
if a[2]>a[1] then bo:=true
else bo:=false;
sum:=0;
for i:=3 to n do
begin
if (a[i]>a[i-1])and not bo then begin inc(sum);write(a[i-1],' ');bo:=true;end
else if (a[i]
program wt(input,output);
var
max,x,m,n,i:longint;
begin
max:=-maxlongint;
readln(n);
for i:=1 to n do
begin
read(x);
if x>max then begin max:=x;m:=i;end;
end;
writeln(max);
writeln(m);
end.
2.program wt(input,output);
var
i,sum,n:longint;
a:array[0..10000]of longint;
bo:boolean;
begin
readln(n);
for i:=1 to n do
read(a[i]);
if a[2]>a[1] then bo:=true
else bo:=false;
sum:=0;
for i:=3 to n do
begin
if (a[i]>a[i-1])and not bo then begin inc(sum);write(a[i-1],' ');bo:=true;end
else if (a[i]
Pascal编程:读入N个数,打印其中的最大数及其位置号
读入N个数,打印其中的最大数及其位置号
pascal求N个数中最大数及其位置
c++编写一个程序读入10个数.输出其中不同的数(即如果一个数出现多次,只打印一次)
如何用C语言编程“输入n个整数,求其中最大数及其所在的位置,并求出此n个数中素数的个数.”
用C语言写程序 ,输入N个数字,打印其中的最大数和最小数的位置,如果有相同的数字,输出最早出现的那一个
写一个程序,使用for语句,计算从键盘读入的一个整 数序列的和.其中读入的第一个数,表示该整数序列
在n个数中,若其中最大的数与它们的平均数相等,这n个数的标准差为( )
在n个数中,若其中的最大数与它们的平均数相等,则这n个数的标准差是多少?
编写C语言程序从n个数中找出其中最大的数?急.
pascal编程 输入n个整数,找出最大数所在的位置,并将它与第一个数对调
一道ACM编程题 大概意思是:读入N个数 和一个数T2个人各在N个数中独立的选1个数 求选出的这两个数乘积大于T的概率.