207 条题解
-
0zhh1993 LV 10 @ 2009-09-12 15:34:02
一遍遍转就好了,反正转四次=没转
注意每个运算分配要细心....... -
02009-09-08 21:38:13@
最后如果不加writeln第2个点会 运行超时|格式错误
-
02009-09-05 19:39:25@
封号的SB
-
02009-09-02 18:14:07@
某菜飞过~~~~~留下一段n长的程序~~~~~~
程序太烂了,大家不要介意啊。
可是我明明定义了9个过程,为什么他说not found "run1"呢?
郁闷ing……Prog98094.pas(10,27) Error: Identifier not found "run1"
Prog98094.pas(10,27) Error: Illegal expression
Prog98094.pas(11,27) Error: Identifier not found "run2"
Prog98094.pas(11,27) Error: Illegal expression
Prog98094.pas(12,27) Error: Identifier not found "run3"
Prog98094.pas(12,27) Error: Illegal expression
Prog98094.pas(13,27) Error: Identifier not found "run4"
Prog98094.pas(13,27) Error: Illegal expression
Prog98094.pas(14,27) Error: Identifier not found "run5"
Prog98094.pas(14,27) Error: Illegal expression
Prog98094.pas(15,27) Error: Identifier not found "run6"
Prog98094.pas(15,27) Error: Illegal expression
Prog98094.pas(16,27) Error: Identifier not found "run7"
Prog98094.pas(16,27) Error: Illegal expression
Prog98094.pas(17,27) Error: Identifier not found "run8"
Prog98094.pas(17,27) Error: Illegal expression
Prog98094.pas(18,27) Error: Identifier not found "run9"
Prog98094.pas(18,27) Error: Illegal expression
Prog98094.pas(103) Fatal: There were 18 errors compiling module, stopping
Fatal: Compilation aborted---|---|---|---|---|---|---|---|-
Unaccepted 有效得分:0 有效耗时:0msvar a,ans:array[1..10]of byte;
i,i1,i2,i3,i4,i5,i6,i7,i8,i9:integer;
function f(k:byte):boolean;
begin
f:=false;
if k mod 4=0 then f:=true;
end;
procedure run(k:byte);
begin
if k=1 then begin run1; exit;end;
if k=2 then begin run2; exit;end;
if k=3 then begin run3; exit;end;
if k=4 then begin run4; exit;end;
if k=5 then begin run5; exit;end;
if k=6 then begin run6; exit;end;
if k=7 then begin run7; exit;end;
if k=8 then begin run8; exit;end;
if k=9 then begin run9; exit;end;
end;
procedure run1;
begin
inc(a[1]);inc(a[2]);inc(a[4]);inc(a[5]);
end;
procedure run2;
begin
inc(a[1]);inc(a[2]);inc(a[3]);
end;
procedure run3;
begin
inc(a[2]) ;inc(a[3]);inc(a[5]);inc(a[6]);
end;
procedure run4;
begin
inc(a[1]);inc(a[4]);inc(a[7]);
end;
procedure run5;
begin
inc(a[2]);inc(a[4]);inc(a[5]);inc(a[6]);inc(a[8]);
end;
procedure run6;
begin
inc(a[3]);inc(a[9]);inc(a[6]);
end;
procedure run7;
begin
inc(a[4]);inc(a[5]);inc(a[7]);inc(a[8]);
end;
procedure run8;
begin
inc(a[7]);inc(a[8]);inc(a[9]);
end;
procedure run9;
begin
inc(a[5]);inc(a[6]);inc(a[8]);inc(a[9]);
end;
begin
for i:=1 to 9 do read(a[i]);for i1:=0 to 3 do
begin run(1);
for i2:=0 to 3 do
begin run(2);
for i3:=0 to 3 do
begin run(3);
for i4:=0 to 3 do
begin run(4);
for i5:=0 to 3 do
begin run(5);
for i6:=0 to 3 do
begin run(6);
for i7:=0 to 3 do
begin run(7);
for i8:=0 to 3 do
begin run(8);
for i9:=0 to 3 do
begin run(9);
if f(a[1])and f(a[2])and f(a[3])and f(a[4])and
f(a[5])and f(a[6])and f(a[7])and f(a[8])and f(a[9]) then
begin
ans[1]:=i1;
ans[2]:=i2;
ans[3]:=i3;
ans[4]:=i4;
ans[5]:=i5;
ans[6]:=i6;
ans[7]:=i7;
ans[8]:=i8;
ans[9]:=i9;
for i:=1 to 9 do if ans[i]0 then write(ans[i],' ');
exit;
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
end.Flag Unaccepted
题号 P1016
类型(?) 搜索
通过 1822人
提交 5092次
通过率 36%
难度 3提交 讨论 题解
-
02009-08-31 20:39:37@
其实这道题目所有的解法都来自于暴力破解。解空间没有什么规律可循,想剪枝也有限的很,还是爆破啊,剪枝优化一下就过了····
-
02009-08-26 12:09:38@
9重循环。。。
小小庆祝下ac70题。。。
-
02009-08-22 16:04:13@
完全相同的程序,小号提交100,AC,0MS,大号提交90,80,70,60,WA,0MS+超时.
无语.........program project1;
var
i,j,k,l,m,n,a,b,c,d,e,f,g,h:longint;
map:array[1..3,1..3]of longint;
function turn(a,b,c,d,e,f,g,h,i:longint):boolean;
var
s:array[1..3,1..3]of longint;
j,k,l:longint;
procedure set1(t:longint);
begin
s[1,1]:=s[1,1]+t;
s[2,2]:=s[2,2]+t;
s[1,2]:=s[1,2]+t;
s[2,1]:=s[2,1]+t;
end;
procedure set2(t:longint);
begin
s[1,1]:=s[1,1]+t;
s[1,2]:=s[1,2]+t;
s[1,3]:=s[1,3]+t;
end;
procedure set3(t:longint);
begin
s[1,3]:=s[1,3]+t;
s[1,2]:=s[1,2]+t;
s[2,2]:=s[2,2]+t;
s[2,3]:=s[2,3]+t;
end;
procedure set4(t:longint);
begin
s[1,1]:=s[1,1]+t;
s[2,1]:=s[2,1]+t;
s[3,1]:=s[3,1]+t;
end;
procedure set5(t:longint);
begin
s[1,2]:=s[1,2]+t;
s[2,1]:=s[2,1]+t;
s[2,2]:=s[2,2]+t;
s[2,3]:=s[2,3]+t;
s[3,2]:=s[3,2]+t;
end;
procedure set6(t:longint);
begin
s[1,3]:=s[1,3]+t;
s[2,3]:=s[2,3]+t;
s[3,3]:=s[3,3]+t;
end;
procedure set7(t:longint);
begin
s[2,2]:=s[2,2]+t;
s[3,2]:=s[3,2]+t;
s[2,1]:=s[2,1]+t;
s[3,1]:=s[3,1]+t;
end;
procedure set8(t:longint);
begin
s[3,1]:=s[3,1]+t;
s[3,2]:=s[3,2]+t;
s[3,3]:=s[3,3]+t;
end;
procedure set9(t:longint);
begin
s[2,2]:=s[2,2]+t;
s[3,2]:=s[3,2]+t;
s[2,3]:=s[2,3]+t;
s[3,3]:=s[3,3]+t;
end;
begin
for j:=1 to 3 do
for k:=1 to 3 do
s[j,k]:=map[j,k];
set1(a);
set2(b);
set3(c);
set4(d);
set5(e);
set6(f);
set7(g);
set8(h);
set9(i);
for j:=1 to 3 do
for k:=1 to 3 do
if s[j,k]mod 40
then exit(false);
exit(true);
end;
procedure print(a,b,c,d,e,f,g,h,i:longint);
var
dd:longint;
begin
for dd:=1 to a do write('1 ');
for dd:=1 to b do write('2 ');
for dd:=1 to c do write('3 ');
for dd:=1 to d do write('4 ');
for dd:=1 to e do write('5 ');
for dd:=1 to f do write('6 ');
for dd:=1 to g do write('7 ');
for dd:=1 to h do write('8 ');
for dd:=1 to i do write('9 ');
end;
begin
for i:=1 to 3 do
readln(map,map,map);
for i:=0 to 3 do
for j:=0 to 3 do
for k:=0 to 3 do
for l:=0 to 3 do
for m:=0 to 3 do
for n:=0 to 3 do
for a:=0 to 3 do
for b:=0 to 3 do
for c:=0 to 3 do
if turn(i,j,k,l,m,n,a,b,c)
then print(i,j,k,l,m,n,a,b,c);
readln;
end.无奈.
-
02009-08-16 11:36:54@
to:不是我
数组不能循环!!! -
02009-08-10 16:32:24@
找到了标准题解???????????李肥888??????
-
02009-08-10 12:40:41@
找到了标准题解。。。
-
02009-08-06 10:39:38@
BFS+Hash判重+剪枝优化
秒杀
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0ms -
02009-08-06 10:26:39@
请教...请教...请教...请教...请教...请教...请教...请教...请教...请教...请教...请教...请教...请教...请教...请教...请教...请教...请教...请教...请教...请教...请教...请教...请教...请教...请教...请教...请教...请教...请教...请教...请教...请教...请教...请教...请教...请教...请教...请教...请教...请教...请教...请教...
编译失败...|错误号:1
Prog78776.pas(25,17) Error: Illegal assignment to for-loop variable "m"
Prog78776.pas(26,21) Error: Illegal assignment to for-loop variable "m"
Prog78776.pas(27,50) Error: Illegal assignment to for-loop variable "m"
Prog78776.pas(28,50) Error: Illegal assignment to for-loop variable "m"
Prog78776.pas(29,57) Error: Illegal assignment to for-loop variable "m"
Prog78776.pas(30,57) Error: Illegal assignment to for-loop variable "m"
Prog78776.pas(31,57) Error: Illegal assignment to for-loop variable "m"
Prog78776.pas(32,57) Error: Illegal assignment to for-loop variable "m"
Prog78776.pas(51) Fatal: There were 8 errors compiling module, stopping
Fatal: Compilation abortedvar c,m:array[1..3,1..3] of integer;
procedure init;
var i,j:integer;
begin
for i:=1 to 3 do
for j:=1 to 3 do begin
read(c);
c:=(4-c) mod 4;
end;
end;function order(k:integer):integer;
var c:integer;
begin
c:=k;
while c4 do dec(c,4);
order:=k;
end;
procedure main;
var i,j,k:integer;
begin
for m[1,1]:=0 to 3 do
for m[1,2]:=0 to 3 do
for m[1,3]:=0 to 3 do begin
m[2,1]:=order(c[1,1]-m[1,1]-m[1,2]);
m[2,3]:=order(c[1,3]-m[1,2]-m[1,3]);
m[2,2]:=order(c[1,2]-m[1,1]-m[1,2]-m[1,3]);
m[3,1]:=order(c[2,1]-m[1,1]-m[2,1]-m[2,2]);
m[3,3]:=order(c[2,3]-m[1,3]-m[2,2]-m[2,3]);
m[3,2]:=order(c[3,2]-m[3,1]-m[3,3]-m[2,2]);
if ((m[2,1]+m[3,1]+m[3,2]) mod 4=c[3,1]) and
((m[2,3]+m[3,2]+m[3,3]) mod 4=c[3,3]) and
((m[2,2]+m[1,1]+m[1,3]+m[3,1]+m[3,3]) mod 4=c[2,2])
then
begin
for i:=1 to 3 do
for j:=1 to 3 do
for k:=1 to m do
write((i-1)*3+j,' ');
exit;
end;
end;
end;
begin
init;
main;
end.郁闷~~~~~~~
-
02009-08-05 17:00:20@
haha~ bfs+hash
puppy 很好很强大!!编译通过...
├ 测试数据 01:答案正确... 275ms
├ 测试数据 02:答案正确... 228ms
├ 测试数据 03:答案正确... 244ms
├ 测试数据 04:答案正确... 244ms
├ 测试数据 05:答案正确... 244ms
├ 测试数据 06:答案正确... 259ms
├ 测试数据 07:答案正确... 244ms
├ 测试数据 08:答案正确... 244ms
├ 测试数据 09:答案正确... 244ms
├ 测试数据 10:答案正确... 228ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:2454ms -
02009-08-05 16:54:06@
BFS+Hash=90
编译通过...
├ 测试数据 01:答案正确... 244ms
├ 测试数据 02:运行超时|无输出...
├ 测试数据 03:答案正确... 259ms
├ 测试数据 04:答案正确... 259ms
├ 测试数据 05:答案正确... 244ms
├ 测试数据 06:答案正确... 244ms
├ 测试数据 07:答案正确... 244ms
├ 测试数据 08:答案正确... 259ms
├ 测试数据 09:答案正确... 244ms
├ 测试数据 10:答案正确... 244ms
---|---|---|---|---|---|---|---|-
Unaccepted 有效得分:90 有效耗时:2241ms -
02009-08-05 13:30:45@
program dyh(input,output);
var
a,p:packed array[1..9]of longint;
i:integer;
procedure print;
var
i,j:integer;
begin
for i:=1 to 9 do
for j:=1 to p[i] do write(i,' ');
writeln;
end;
function order(i:integer):integer;
begin
exit((i mod 4+4)mod 4);
end;
begin
read(a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9]);
for i:=1 to 9 do
a[i]:=(4-a[i])mod 4;
for p[1]:=0 to 3 do
for p[2]:=0 to 3 do
for p[3]:=0 to 3 do
begin
p[4]:=order(a[1]-p[1]-p[2]);
p[5]:=order(a[2]-p[1]-p[2]-p[3]);
p[6]:=order(a[3]-p[2]-p[3]);
p[7]:=order(a[4]-p[1]-p[4]-p[5]);
p[9]:=order(a[6]-p[3]-p[5]-p[6]);
p[8]:=order(a[8]-p[5]-p[7]-p[9]);
if (a[5]=(p[1]+p[3]+p[5]+p[7]+p[9])mod 4)and(a[7]=(p[4]+p[7]+p[8])mod 4)and(a[9]=(p[6]+p[8]+p[9])mod 4) then begin
print;
exit;
end;
end;
end. -
02009-07-31 22:37:33@
1.DFS(仅供参考)
2.每种操作只可能选0~~3次 -
02009-07-29 21:25:52@
用传说中的九重循环秒过!!
真是不可思议, 哎 vijos的评测机就是好
要是比赛用vijos的机子就好了 -
02009-07-28 11:27:59@
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0ms九重循环!!!
-
02009-07-24 18:09:49@
顺序非降很重要 比如4 5 8 下次就只能试 9 了;
program project1;
type arr=array[1..9]of integer;
re=record
s:string;
state:arr
end;
poi=^node;
node=record
data:re;
link:poi;
end;var a:array[0..262144] of boolean;
base:array[1..9,0..5]of integer;
start:re;
head,tail:poi;
num:longint;
stop:boolean;
w:array[1..9]of longint;procedure datain;
var p,i,j:integer;
begin
p:=0;
for i:= 1 to 3 do
begin
for j:= 1 to 3 do
begin
inc(p);
read(start.state[p]);
end;
readln;
end;
end;procedure push(t:re);
var temp:poi;
begin
if num=0 then
begin
head^.data:=t;
end
else
begin
new(temp);
temp^.link:=nil;
temp^.data:=t;
tail^.link:=temp;
tail:=temp;
end;
inc(num);
end;function eva(t:re):longint;
var i:integer;
a:arr;
begin
a:=t.state;
eva:=0;
for i:= 1 to 9 do
begin
eva:=eva+a[i]*w[i];
end;
end;procedure setup;
var i:integer;
begin
w[1]:=1;
for i:= 2 to 9 do w[i]:=w*4;
fillchar(a,sizeof(a),false);start.s:='';
new(head);
tail:=head;
num:=0; stop:=false;base[1,0]:=4; base[1,1]:=1; base[1,2]:=2; base[1,3]:=4; base[1,4]:=5;{1}
base[2,0]:=3; base[2,1]:=1; base[2,2]:=2; base[2,3]:=3; {2}
base[3,0]:=4; base[3,1]:=2; base[3,2]:=3; base[3,3]:=5; base[3,4]:=6;{3}
base[4,0]:=3; base[4,1]:=1; base[4,2]:=4; base[4,3]:=7; {4}
base[5,0]:=5; base[5,1]:=2; base[5,2]:=4; base[5,3]:=5; base[5,4]:=6; base[5,5]:=8; {5}
base[6,0]:=3; base[6,1]:=3; base[6,2]:=6; base[6,3]:=9; {6}
base[7,0]:=4; base[7,1]:=4; base[7,2]:=5; base[7,3]:=7; base[7,4]:=8;{7}
base[8,0]:=3; base[8,1]:=7; base[8,2]:=8; base[8,3]:=9; {8}
base[9,0]:=4; base[9,1]:=5; base[9,2]:=6; base[9,3]:=8; base[9,4]:=9;{9}push(start);
a[eva(start)]:=true;
end;function pop:re;
var temp:poi;
begin
if num -
02009-07-24 16:16:31@
编译通过...
├ 测试数据 01:运行时错误...| 错误号: 216 | 存取非法
├ 测试数据 02:运行时错误...| 错误号: 216 | 存取非法
├ 测试数据 03:运行时错误...| 错误号: 216 | 存取非法
├ 测试数据 04:运行时错误...| 错误号: 216 | 存取非法
├ 测试数据 05:运行时错误...| 错误号: 216 | 存取非法
├ 测试数据 06:运行时错误...| 错误号: 216 | 存取非法
├ 测试数据 07:运行时错误...| 错误号: 216 | 存取非法
├ 测试数据 08:运行时错误...| 错误号: 216 | 存取非法
├ 测试数据 09:运行时错误...| 错误号: 216 | 存取非法
├ 测试数据 10:运行时错误...| 错误号: 216 | 存取非法const
d:array[1..9] of integer=(4,3,4,3,5,3,4,3,4);
f:array[1..9,1..5] of integer= ((1,2,4,5,0),
(1,2,3,0,0),
(2,3,5,6,0),
(1,4,7,0,0),
(2,4,5,6,8),
(3,6,9,0,0),
(4,5,7,8,0),
(7,8,9,0,0),
(5,6,8,9,0));
var
a,st,p:array[1..9] of longint;
c:array[1..40] of longint;
i,l:longint;
bo:boolean;
procedure hs(t:longint);
var
i,j,l:longint;
begin
if t