158 条题解
-
0495250800 LV 3 @ 2009-07-07 22:34:15
type arr=array[-10000..40000] of int64;
var n,i,j:longint;
a:arr;
y,s,w,z,t,k:longint;begin
readln(n);
for i:=1 to n do
begin
z:=0;
read(y,s,w);
readln;
z:=y+s+w;
a[i]:=z*1000000+y*10000-i*1000+i;
end;
for i:=1 to n -1 do
for j:=n downto i+1 do
if a[j-1] -
02009-07-06 21:22:56@
冒泡比较实用,恩!
-
02009-06-22 16:06:45@
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0ms
三条件快排 EASY -
02009-06-14 11:03:37@
program scholar;
type school=record
nu:0..300;
ch:0..100;
all:0..300;
end;
var sh:array[1..300]of school;
n,a,b,c,i,j,k:integer;begin
readln(n);
for i:=1 to n do
begin
read(a,b,c);
sh[i].nu:=i;
sh[i].ch:=a;
sh[i].all:=a+b+c;
readln;
end;
for i:=1 to n do
for j:=1 to n-i do
if sh[j].all -
02009-06-10 12:41:14@
#include
using namespace std;
int main (){
int n;
cin>>n;
int a[n+1],b[n+1],c[n+1],sum[n+1];
memset (a,0,sizeof (a));
memset (b,0,sizeof (b));
memset (c,0,sizeof (c));
memset (sum,0,sizeof (sum));
int i,j,max,maxl,k=0;
for (i=1;i>a[i]>>b[i]>>c[i];sum[i]=a[i]+b[i]+c[i];}
for (i=1;ia[maxl]){max=sum[j];maxl=j;}
else if (j -
02009-05-31 19:59:53@
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0ms
var
a:array[1..10000,1..6]of longint;
n,i,j,m:longint;
begin
readln(n);
for i:=1 to n do
begin
readln(a,a,a);
a:=a+a+a;
a:=i;
a:=a*10000+a*100-a;
end;
for i:=1 to n-1 do
for j:=i+1 to n do
begin
if a -
02009-05-29 11:36:33@
#include "stdio.h"
int wm(int a[],int n)
{
int i,max=-1,t=1;
for(i=1;imax)
{
max=a[i];
t=i;
}
return t;
}int main(void)
{
int n,i,k;
int ch,ma,en;
int sum[100000],ans[100000];
scanf("%d",&n);
for (i=1;i -
02009-05-29 10:28:14@
type
aa=record
y,s,w:integer;
end;
bb=record
f,h:integer;
end;
var a:array[1..300]of aa;
b:array[1..5]of bb;
n,i,j,k,t:integer;
f:boolean;
begin
readln(n);
for i:=1 to 5 do
with b[i] do begin
f:=0;
h:=0;
end;
for i:=1 to n do begin
with a[i] do read(y,s,w);
j:=1;
f:=true;
t:=a[i].y+a[i].s+a[i].w;
while (jb[j].f)or((t=b[j].f)and(a[i].y>a[b[j].h].y)) then begin
for k:=5 downto j+1 do begin
b[k].f:=b[k-1].f;
b[k].h:=b[k-1].h;
end;
b[j].f:=t;
b[j].h:=i;
f:=false;
end else if (t=b[j].f)and(a[i].y=a[b[j].h].y) then begin
for k:=5 downto j+2 do begin
b[k].f:=b[k-1].f;
b[k].h:=b[k-1].h;
end;
b[j+1].h:=i;
b[j+1].f:=t;
f:=false;
end;
j:=j+1;
end;
end;
for i:=1 to 5 do
with b[i] do writeln(h,' ',f);
end. -
02009-05-17 19:49:08@
#include
using namespace std;
int wm(int a[],int n){
int i,max=-1,t=1;
for (i=1;imax){
max=a[i];
t=i;
}
return (t);
}int main(){
int n,i,k;
cin>>n;
int ch,ma,en;//语文ch,数学ma,英语en
int sum[n+1],ans[n+1];
for (i=1;i>ch>>ma>>en;
ans[i]=0+ch+ma+en;
sum[i]=ans[i]*10000+ch*100-i;
}
for (i=0;i -
02009-04-23 13:03:49@
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms -
02009-04-20 12:55:52@
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0msvar n,i,j,k:integer;
a:array[1..10000,0..4] of integer;
begin
read(n);
for i:=1 to n do
begin
readln(a,a,a);
a:=i;
end;
for i:=1 to n do
a:=a+a+a;
for i:=1 to n-1 do
for j:=i+1 to n do
if a -
02009-04-14 12:32:11@
var a,b,ch,en,ma:array[1..2000]of integer;
i,j,t,n:integer;
begin
read(n);
for i:=1 to n do
begin
read(ch[i],en[i],ma[i]);
b[i]:=i;
end;
for i:=1 to n do
a[i]:=ch[i]+en[i]+ma[i];
for i:=1 to n do
for j:=i+1 to n do
begin
if a[i]ch[j])
then begin
t:=ch[i];
ch[i]:=ch[j] ;
ch[j]:=t;
end
else if (ch[i]=ch[j]) and (b[i]>b[j])
then begin
t:=b[i];
b[i]:=b[j];
b[j]:=t;
end
end;
for i:= 1 to 5 do
writeln(b[i],' ',a[i]);
end. -
02009-04-14 12:07:51@
var i,j,t,n:integer;
a,b,c,s,x:array[1..9999]of longint;
begin
readln(n);
for i:=1 to n do
begin
readln(a[i],b[i],c[i]);
x[i]:=i;
s[i]:=a[i]+b[i]+c[i];
end;
for i:=1 to n-1 do
for j:=i+1 to n do
if (s[i] -
02009-04-06 14:30:02@
program hgh;
type
n=record
chi,math,eng:integer;
end;
var
a:array[1..10000] of n;
i,j,x,m:integer;
s,no:array[1..10000] of integer;
begin
readln(x);
for i:=1 to x do
no[i]:=i;
for i:=1 to x do
begin
with a[i] do
begin
readln(chi,math,eng);
s[i]:=chi+math+eng;
end;
end;
for i:=1 to x-1 do
for j:=i+1 to x do
if s[i]=s[j] then
begin
if a[i].chi -
02009-04-01 20:38:12@
var
i,j,s,t,m,n,v,l:longint;
a:array[1..300,1..4]of integer; b:Array[1..300]of integer;
begin
read(n);
for i:=1 to n do
b[i]:=i;
for i:=1 to n do
for j:=1 to 3 do
read(a);
for i:=1 to n do
for j:=1 to 3 do
a:=a+a;
for i:=1 to n-1 do
for j:=i to n do
if (a -
02009-03-18 15:45:53@
...
-
02009-03-07 16:13:08@
冒泡都能过......
看清题目很重要!!.. -
02009-03-04 13:26:46@
冒泡排序....
-
02009-02-27 20:58:26@
type
student=record
num:0..10000;
chinese:integer;
math:integer;
english:integer;
total:integer;
end;
var
stu:array [1..10000]of student;
t:student;
i,j,n:integer;
begin
readln(n);
for i:=1 to n do with stu[i]do num:=i;
for i:=1 to n do
begin with stu[i]do begin
readln(chinese,math,english);total:=chinese+math+english;end;
end;
for i:=1 to n-1 do
for j:=i+1 to n do
if (stu[i].total -
02009-02-15 14:56:55@
program a1(input,output);
var
n,x,y,z,i,j:integer;
a:array[1..300,1..3] of integer;
procedure swap(var a,b:integer); {交换过程}
var
s:integer;
begin
s:=a;
a:=b;
b:=s;
end;
begin
assign(input,'scholar.in');
assign(output,'scholar.out');
reset(input);
rewrite(output);
readln(n);
for i:=1 to n do
begin
readln(x,y,z);
a:=i;
a:=x;
a:=x+y+z;
end;
for i:=1 to n-1 do {选择排序}
for j:=i+1 to n do
if (a