日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

JZOJ__Day 6:【普及模拟】Oliver的成绩(score)

發(fā)布時間:2025/3/15 编程问答 22 豆豆
生活随笔 收集整理的這篇文章主要介紹了 JZOJ__Day 6:【普及模拟】Oliver的成绩(score) 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

題目描述

Oliver進入初中后,覺得自己不能總是玩兒了,應該要好好學習了。正好一次考試結(jié)束了,Oliver想知道自己的語文,數(shù)學,英語分別與語文年級第一,數(shù)學年級第一,英語年級第一相差多少。
由于Oliver所在年級有N個人,所以Oliver想你編個程序幫幫他。

輸入

score.in共3N+4行,第一~三行分別為Oliver的語文數(shù)學英語成績(位數(shù)M),第四行為N,以下3N行,每行一個數(shù)(它們的位數(shù)是M),分別為第N個同學的語文,數(shù)學,英語成績。
即:Oliver的語文 數(shù)學 英語
N
第一個人的語文
數(shù)學
英語
第二個人的語文

輸出

score.out共一行,有三個數(shù),分別為Oliver的語文數(shù)學英語與年級第一的差。
如果Oliver是第一,則輸出0.

樣例輸入

10
10
10
3
0
80
0
40
0
0
0
0
100

樣例輸出

30 70 90

【數(shù)據(jù)范圍】
對于50%的數(shù)據(jù),0< N < 1000,0< M <19.
對于100%的數(shù)據(jù),0< N <10000,0< M <30.且都為整數(shù)。

分析
這一題的意思是說,給出三科成績,分別與其他的N個人的成績作比較,并輸出 單科最高成績 減Oliver單科成績。值得注意的是,成績的位數(shù)可能有M(0

type arr=array[-10..30]of longint; const max=30; var j,n,i:longint; x1,x2,x3,zfc,c,z,y,x:ansistring; procedure jian(s1,s2:ansistring); var a,b:arr; l1,l2,i,g,j:longint; beginfillchar(a,sizeof(a),0);fillchar(b,sizeof(b),0);l1:=length(s1);l2:=length(s2);for i:=1 to l1 doa[max-l1+i]:=ord(s1[i])-ord('0');for i:=1 to l2 dob[max-l2+i]:=ord(s2[i])-ord('0');g:=0;for i:=max downto 1 doif a[i]>=b[i]+g thenbegina[i]:=a[i]-b[i]-g;g:=0;end elsebegina[i]:=a[i]+10-b[i]-g;g:=1;end;i:=1;while (i<max)and(a[i]=0) do inc(i);for j:=i to max dowrite(a[j]);write(' '); end;beginassign(input,'score.in');reset(input);assign(output,'score.out');rewrite(output);readln(x);zfc:='';for i:=1 to length(x) doif x[i]<>' ' then zfc:=zfc+x[i];x:=zfc;readln(y);zfc:='';for i:=1 to length(y) doif y[i]<>' ' then zfc:=zfc+y[i];y:=zfc;readln(z);zfc:='';for i:=1 to length(z) doif z[i]<>' ' then zfc:=zfc+z[i];z:=zfc;readln(n);x1:='';x2:='';x3:='';for i:=1 to n dobeginreadln(c);zfc:='';if length(c)>=length(x1) thenbeginfor j:=1 to length(c) doif c[j]<>' ' then zfc:=zfc+c[j];if zfc>=x1 then x1:=zfc;end;readln(c);zfc:='';if length(c)>=length(x2) thenbeginfor j:=1 to length(c) doif c[j]<>' ' then zfc:=zfc+c[j];if zfc>=x2 then x2:=zfc;end;readln(c);zfc:='';if length(c)>=length(x3) thenbeginfor j:=1 to length(c) doif c[j]<>' ' then zfc:=zfc+c[j];if zfc>=x3 then x3:=zfc;end;end;if x1=x then write(0,' ') else if (length(x1)<length(x)) then write(0,' ') else if (x1>x)or(length(x1)>=length(x)) then jian(x1,x);if x2=y then write(0,' ') else if (length(x2)<length(y)) then write(0,' ') else if (x2>y)or(length(x2)>=length(y)) then jian(x2,y);if x3=z then write(0,' ') else if (length(x3)<length(z)) then write(0,' ') else if (x3>z)or(length(x3)>=length(z)) then jian(x3,z);close(input);close(output); end.

轉(zhuǎn)載于:https://www.cnblogs.com/YYC-0304/p/9500089.html

總結(jié)

以上是生活随笔為你收集整理的JZOJ__Day 6:【普及模拟】Oliver的成绩(score)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。