国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

普及練習場之簡單的模擬

2019-11-14 12:43:16
字體:
來源:轉載
供稿:網友

前言:如標題所說。

P1003 鋪地毯 總:look前言。

var s,n,m,t,p:longint; a,b,x,y:array [1..10001] of longint;begin readln(s); for t:=1 to s do readln(a[t],b[t],x[t],y[t]); readln(n,m); p:=0; for t:=1 to s do if (n>=a[t]) and (n<=a[t]+x[t]) and (m>=b[t]) and (m<=b[t]+y[t]) then p:=t; if p=0 then write('-1') else write(p);end.

P1017 進制轉換 總:同上。

const ss='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';var n,x,i,m:longint; s:string;begin readln(n,x); m:=n; s:=''; repeat i:=m mod x; m:=m div x; if i<0 then begin i:=i-x; m:=m+1; end; s:=ss[i+1]+s; until m=0; writeln(n,'=',s,'(base',x,')');end.

總:同上,注意情況。 P1067 多項式輸出

var n,s,i:longint;begin readln(n); for i:=1 to n+1 do begin read(s); if s=0 then continue; if s<0 then write('-'); if (i>1)and(s>0) then write('+'); if (abs(s)>1) or (i=n+1) then write(abs(s)); if i<n+1 then begin write('x'); if (i<n) then write('^',n-i+1); end; end;end.

P1540 機器翻譯 總:開個數組記錄,然后…模擬。

var q:array[0..10000]of longint; m,n,x,i,j:longint; head,tail,ans:longint; f:boolean;begin readln(m,n); head:=1; tail:=0; ans:=0; for i:=1 to n do begin read(x); f:=false; for j:=head to tail do if x=q[j] then begin f:=true; break end; if f then continue; inc(tail); q[tail]:=x; inc(ans); if ans>m then inc(head); end; write(ans);end.

P1056 排座椅 點擊:排座椅題解

P1125 笨小猴 總:將字母大寫化(小寫化也行),用數組統計,暴力max and min,判斷質數。

var s:string; l,i,j,max,min,k:longint; a:array ['A'..'Z'] of longint; t:char; f:boolean;begin readln(s); l:=length(s); for i:=1 to l do begin s[i]:=upcase(s[i]); inc(a[s[i]]); end; max:=0; min:=maxlongint; for t:='A' to 'Z' do begin if (max<a[t]) and (a[t]<>0) then max:=a[t]; if (min>a[t]) and (a[t]<>0) then min:=a[t]; end; k:=max-min; if k<=1 then begin writeln('No Answer'); write('0'); exit; end; f:=true; for i:=2 to trunc(sqrt(k)) do if k mod i=0 then begin f:=false; break; end; if f=true then begin writeln('Lucky Word'); write(k); end else begin writeln('No Answer'); write('0'); end;end.
上一篇:洛谷_P1056 排座椅

下一篇:3.4 等比數列

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 托里县| 行唐县| 米泉市| 阿鲁科尔沁旗| 岢岚县| 满洲里市| 博客| 浦东新区| 聂拉木县| 互助| 二手房| 龙泉市| 荣成市| 深水埗区| 肃宁县| 刚察县| 黔江区| 湖州市| 祁阳县| 政和县| 海原县| 五河县| 易门县| 涿州市| 沙河市| 仪征市| 浠水县| 大冶市| 龙里县| 正镶白旗| 南昌县| 铁力市| 阿鲁科尔沁旗| 札达县| 芦山县| 大安市| 桦川县| 凤阳县| 莱西市| 茶陵县| 桃源县|