jzoj 1147. WING(wing)

    xiaoxiao2025-12-31  9

    1147. WING(wing)  (File IO): input:wing.in output:wing.out

    时间限制:  1000 ms  空间限制:  262144 KB  具体限制   Goto ProblemSet

    题目描述

    输入

    输出

    样例输入

    对于这道题,如果把它理解为一个拼图游戏,其实很简单,代码如下: var f:array[1..10,'A'..'Z']of longint; n,c,ans,i,j,k,l:longint; s:string; begin assign(input,'wing.in'); reset(input); assign(output,'wing.out'); rewrite(output); readln(n,c); for i:=1 to c do begin read(j,s); delete(s,1,1); l:=0; if j=1 then begin for k:=1 to n do begin if f[k,s[k]]=0 then begin l:=-1; break; end; if f[k,s[k]]>l then l:=f[k,s[k]]; end; end else begin inc(ans); for k:=1 to n do if f[k,s[k]]=0 then f[k,s[k]]:=ans; end; if j=1 then writeln(l); end; close(input); close(output); end.

    样例输出

    -1 1 2
    转载请注明原文地址: https://ju.6miu.com/read-1305527.html
    最新回复(0)