滑动输入法
乱搞即可,不得吐槽题目数据,明明说单词长度小于等于10,结果有很多11的。DFS生成所有可能字符串还有50分,判断矩形与圆相交时半径忘记平方居然有90分,彻底无语。考试的时候还犹豫会不会太暴力,其实看到数据范围小就不应该害怕了。
Code var x1,x2,y1,y2,count:array[1..20] of longint; c:array[1..20] of char; ch:char; word:array[1..20] of string; x,y:array[1..20] of longint; w,tot,R,m,n,i,j,ans,minj:longint; find:array[1..20] of boolean; Q:array[1..20,1..20] of char; function ok(i,j:integer):boolean; begin ok:=((x1[j]<=x[i])and(x[i]<=x2[j])and (y1[j]-R<=y[i])and(y[i]<=y2[j]+R)) or ((y1[j]<=y[i])and(y[i]<=y2[j])and (x1[j]-R<=x[i])and(x[i]<=x2[j]+R)) or((x[i]-x1[j])*(x[i]-x1[j])+(y[i]-y1[j])*(y[i]-y1[j])<=R*R) or((x[i]-x1[j])*(x[i]-x1[j])+(y[i]-y2[j])*(y[i]-y2[j])<=R*R) or((x[i]-x2[j])*(x[i]-x2[j])+(y[i]-y1[j])*(y[i]-y1[j])<=R*R) or((x[i]-x2[j])*(x[i]-x2[j])+(y[i]-y2[j])*(y[i]-y2[j])<=R*R); end; function check(str:string):boolean; var i,j:longint; ok:boolean; begin check:=true; for i:=1 to length(str) do begin ok:=false; for j:=1 to count[i] do if Q[i][j]=str[i] then begin ok:=true; break; end; if not ok then exit(false); end; end; procedure Sort; var i,j:longint; temp:string; begin for i:=1 to tot-1 do begin temp:=word[i];minj:=i; for j:=i+1 to tot do if word[j]<temp then begin temp:=word[j]; minj:=j; end; word[minj]:=word[i]; word[i]:=temp; end; end; BEGIN readln(n,m,w);readln(r); for i:=1 to n do read(x1[i],y1[i],x2[i],y2[i],ch,c[i]); for i:=1 to m+1 do readln(x[i],y[i]); for i:=1 to w do begin inc(tot); readln(word[tot]); if length(word[tot])<>m+1 then dec(tot); end; if tot=0 then begin writeln(0);halt;end; for i:=1 to m+1 do for j:=1 to n do if ok(i,j) then begin inc(count[i]); Q[i][count[i]]:=c[j]; end; Sort; for i:=1 to tot do begin find[i]:=check(word[i]); if find[i] then inc(ans); end; writeln(ans); for i:=1 to tot do if find[i] then writeln(word[i]); END.
Edward的可乐旅行
一个大坑
Mrw的工资计划
又一个大坑
hzzstep
找规律,在excel里面填一下,单纯凑规律。有些地方要特判。
Code uses math; var x,y,t,x0,y0:int64; dis:qword; count:int64; BEGIN readln(x,y); t:=max(abs(x),abs(y)); dis:=(t<<1)*(t<<1); x0:=-t;y0:=t; if(x=x0) then inc(dis,y0-y)else if(y=y0) then dec(dis,x-x0)else if(x=-x0)and(y<>-y0) then begin dec(dis,t<<1); dec(dis,y0-y); end else inc(dis,t<<1+x-x0); writeln(dis); END.
std写的挺短
Code#include<math.h> #include<stdio.h> #include<iostream> using namespace std; int x,y,ans,s; int main() { scanf("%d%d",&x,&y); s=max(abs(x),abs(y)); ans=2*s*(2*s-1); if(x==s) ans-=(s-y); if(y==s) ans+=(s-x); else if(x==-s) ans+=(2*s+(s-y)); else if(y==-s) ans+=((4*s)+(s+x)); if(x==s && y==-s) ans=2*s*(2*s+2); printf("%d",ans); system("pause"); return 0; }
751人参赛,500多人有分,我150分名次80多,唉,第一题过了的话是200分,那就是40多名了。DP啊,树啊都是漏洞。LCA只会一次查询的,离线做法还不会啊。