158 条题解
-
0764009615 LV 6 @ 2012-11-13 18:21:10
var
n,i,j:integer;
x,y,z,m:integer;
a,b,c:array[0..300] of integer;
begin
readln(n);
for i:=1 to n do
begin
readln(x,y,z);
a[i]:=x+y+z;
b[i]:=x;
c[i]:=i;
end;
for j:=n-1 downto 1 do
for i:=1 to j do
if (a[i] -
02012-11-13 17:41:14@
program scholar;
var
yw,sx,yy,zf,xh:array [1..301] of integer;
i,j,k,n,jh:longint;
begin
readln(n);
for i:=1 to n do begin readln(yw[i],sx[i],yy[i]); zf[i]:=yw[i]+sx[i]+yy[i];xh[i]:=i;end;
for i:=2 to n do
if (zf -
02012-11-07 20:25:17@
var yu,math,eng,num,s:array[1..300] of integer;
n,i,max,ms,a:integer;
begin
read(n);
for i:=1 to n do
begin
readln(yu[i],math[i],eng[i]);
num[i]:=i;
s[i]:=yu[i]+math[i]+eng[i];
end;
for a:=1 to 5 do
begin
max:=0; ms:=0;
for i:=1 to n do
begin
if max -
02012-11-07 19:36:14@
type t=record
chinese,math,english,number,sum:integer;
end;
var i,j,k,n:integer;
a:array[1..300] of t;
temp:t;
begin
readln(n);
for i:=1 to n do
begin
read(a[i].chinese,a[i].math,a[i].english);
a[i].number:=i;
a[i].sum:=a[i].chinese+a[i].math+a[i].english;
end;
for i:=1 to n-1 do
for j:=i+1 to n do
begin
if a[i].sum -
02012-11-08 21:59:35@
让我插排了三次。。相当恶心的一道题
点这里查看程序源码+详细题解
-
02010-07-08 20:13:00@
var m,yw : array[1..10000] of integer;
n,i,j,k,yu,shu,ying,ans,max,l: longint;
begin
readln(n);
for i:=1 to n do
begin
readln(yu,shu,ying);
m[i]:=yu+shu+ying;
yw[i]:=yu;
end;
l:=0;
for i:=1 to n do
begin
k:=i; max:=m[i];
for j:=1 to n do
begin
if m[j]>max then begin max:=m[j];k:=j; end
else
if (m[j]=max) and (yw[j]>yw[k]) then k:=j
else if (m[j]=max) and (yw[j]=yw[k]) and (j -
02009-11-08 20:33:35@
#include
using namespace std;
struct stu
{
int xuehao;
float yuwen;
float shuxue;
float yingyu;
float zongfen;
};
int main()
{
int n,i,j;
cin>>n;
struct stu a[n];
for (i=0;i>a[i].yuwen>>a[i].shuxue>>a[i].yingyu;
a[i].xuehao=i+1;
a[i].zongfen=a[i].yuwen+a[i].yingyu+a[i].shuxue;
}
for (i=0;i -
02009-11-04 13:51:34@
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0ms
program lq;
const
inf='scholar.in';
ouf='scholar.out';
var
n,m,i,j:longint;
a:array[0..300,1..3] of longint;
ans,nom:array[0..300] of longint;procedure sort(l,r:longint);
var
i,j,x,y:longint;
begin
i:=l;j:=r;x:=ans[random(r-l+1)+l];
repeat
while ans[i]x do dec(j);
if ij;
if l -
02009-11-04 13:28:24@
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0ms#include
using namespace std;class student
{
public:
void read()
{cin>>yuwen>>shuxue>>yinyu;}
void sum()
{total=yuwen+shuxue+yinyu;}
int total;
int num;
int yuwen;
int shuxue;
int yinyu;};
int cmp(const void *a,const void *b)
{
student *first,*second;
first=(class student *)a;
second=(class student *)b;
student m1,m2;
m1=*first;
m2=*second;
if(m1.total>m2.total)return 1;
if(m1.total==m2.total)
{
if(m1.yuwen>m2.yuwen)return 1;
if(m1.yuwen -
02009-11-02 16:31:38@
var a,b,c,d,e:array[1..10000]of integer;
i,j,n,t:integer;
begin
readln(n);
for i:=1 to n do readln(a[i],b[i],c[i]);
for i:=1 to n do d[i]:=a[i]+b[i]+c[i];
for i:=1 to n do e[i]:=i;
for i:=1 to n-1 do
for j:=i+1 to n do
if d[i] -
02009-11-01 18:22:24@
program jiangxuejin;
var
a:array[1..10000,1..5] of longint;
i,j,k,m,n:longint;
begin
readln(m);
for i:=1 to m do
begin
a:=i;
readln(a,a,a);
a:=a+a+a;
end;
for i:=1 to m-1 do
for j:=i+1 to m do
if a -
02009-10-22 18:36:07@
var
a :array[1..10000,1..5] of longint ;
s,n,i,j,x : longint ;
procedure huan(var a,b:longint);
var
t :longint ;
begin
t:=a; a:=b; b:=t;
end;
procedure kuai(l,r : longint );
var
i,j,m : longint ;
begin
i := l;
j := r;
m := a[l,5];
repeat
while a>m do inc(i);
while a[j,5] -
02009-10-22 14:39:42@
这个题特别的水,我用选择就过了。。丝毫不用优化。。生加,生排序,一切皆有可能。。
-
02009-10-19 13:13:13@
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0mstype rec=record
c:integer;
m:integer;
e:integer;
n:integer;
s:integer;
end;
rec2=record
s:longint;
n:integer;
end;
atype=array[1..300] of rec;
btype=array[1..300] of rec2;
var a:atype;
b:btype;
s,s1,s2,s3:string;
code,i,n,j:integer;
procedure sort(n:integer; var b:btype);
var i,j:integer;
t:longint;
begin
for i:=1 to n do
for j:=1 to i-1 do
if b[i].s>b[j].s then begin
t:=b[i].s; b[i].s:=b[j].s; b[j].s:=t;
t:=b[i].n; b[i].n:=b[j].n; b[j].n:=t;
end;
end;begin
readln(n);
for i:=1 to n do begin
readln(a[i].c,a[i].m,a[i].e);
a[i].s:=a[i].c+a[i].m+a[i].e;
a[i].n:=i;
end;
for i:=1 to n do begin
str(a[i].s,s1);
str(a[i].c,s2);
str(n-i+1,s3);
if length(s1) -
02009-10-17 19:53:02@
抄你的为什么没有编译
-
02009-10-06 20:06:09@
var a,b,c:array[1..100000]of longint;
d,e,i,j,max,mp:longint;
begin
readln(e);
for i:=1 to e do
readln(a[i],b[i],c[i]);
for i:=1 to 5 do
begin
max:=0;
for j:=1 to e do
begin
d:=a[j]+b[j]+c[j];
if max=d then
if a[j]>a[mp] then
begin
max:=d;
mp:=j
end;
if max -
02009-10-05 13:40:21@
用得着知道n吗,开五个变量存就好了(我开了六个,第六个用来容错)
-
02009-10-04 18:13:12@
#include
using namespace std;
int main()
{
int ch(0),m(0),eng(0),max(0),arr[300],count(0);
size_t n(0);
cin>>n;
for(size_t ix(0);ix!=n;++ix){
int all(0);
cin>>ch>>m>>eng;
all=ch+m+eng;
arr[ix]=all;
}
for(size_t index(0);index!=n;++index){
for(size_t i(0);i!=n;++i){
if(max -
02009-10-04 15:37:48@
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0ms比较好理解的做法,比较项只有3项直接写就行,如果有很多的话~~~~自己想吧。。
program vijos_1398;
const
maxN=1000;type
TData=record
a,b,c,sum,num:longint
end;var
n:longint;
d:array[1..maxN] of TData;procedure init;
var
i:longint;
begin
readln(n);
for i:=1 to n do
with d[i] do begin
readln(a,b,c);
sum:=a+b+c;
num:=i;
end;
end;procedure main;
var
i,j:longint;
t:TData;
begin
for i:=1 to n-1 do
for j:=i+1 to n do
if (d[i].sum -
02009-10-03 15:28:07@
小技巧:无需判断语文分数 只要把总分改为实数 把语文成绩改为小数部分即可
一次AC
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0ms