170 条题解
-
0玛维-影之歌 LV 10 @ 2008-09-16 12:02:36
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0ms
真是...输入烦死了...搜索回溯直接秒杀 -
02008-09-08 21:12:04@
此题超水.3...DFS乱搜...
-
02008-09-08 18:47:01@
有错,大牛帮帮忙,谢谢。
上10k的程序可使不多见了……var
a:array[1..4] of integer;
procedure init;
var
s:string;
p,i,k:integer;
begin
readln(s);
s:=s+' ';
p:=1;
k:=0;
for i:=1 to length(s) do
if s[i]=' ' then
begin
if i-k=3 then a[p]:=10
else
case s of
'1':a[p]:=1;
'2':a[p]:=2;
'3':a[p]:=3;
'4':a[p]:=4;
'5':a[p]:=5;
'6':a[p]:=6;
'7':a[p]:=7;
'8':a[p]:=8;
'9':a[p]:=9;
'J':a[p]:=11;
'Q':a[p]:=12;
'K':a[p]:=13;
end;
k:=i;
p:=p+1;
end;
end;
procedure find(q,w,e,r:integer);
begin
if q+w+e+r=24 then begin writeln(1); halt; end;
if q+w+e-r=24 then begin writeln(1); halt; end;
if q+w+e*r=24 then begin writeln(1); halt; end;
if q+(w+e)*r=24 then begin writeln(1); halt; end;
if (q+w+e)*r=24 then begin writeln(1); halt; end;
if (r0) and (e mod r=0) and (q+w+e div r=24) then begin writeln(1); halt; end;
if (r0) and ((w+e) mod r=0) and (q+(w+e) div r=24) then begin writeln(1); halt; end;
if (r0) and ((q+w+e) mod r=0) and ((q+w+e) div r=24) then begin writeln(1); halt; end;
if q+w-e+r=24 then begin writeln(1); halt; end;
if q+w-e-r=24 then begin writeln(1); halt; end;
if q+w-e*r=24 then begin writeln(1); halt; end;
if q+(w-e)*r=24 then begin writeln(1); halt; end;
if (q+w-e)*r=24 then begin writeln(1); halt; end;
if (r0) and (e mod r=0) and (q+w-e div r=24) then begin writeln(1); halt; end;
if (r0) and ((w-e) mod r=0) and (q+(w-e) div r=24) then begin writeln(1); halt; end;
if (r0) and ((q+w-e) mod r=0) and ((q+w-e) div r=24) then begin writeln(1); halt; end;
if q+w*e+r=24 then begin writeln(1); halt; end;
if q+w*e-r=24 then begin writeln(1); halt; end;
if q+w*e*r=24 then begin writeln(1); halt; end;
if (q+w)*e*r=24 then begin writeln(1); halt; end;
if (r0) and ((e*w) mod r=0) and (q+w*e div r=24) then begin writeln(1); halt; end;
if (r0) and ((e*(w+q)) mod r=0) and ((q+w)*e div r=24) then begin writeln(1); halt; end;
if (e0) and (w mod e=0) and (q+w div e+r=24) then begin writeln(1); halt; end;
if (e0) and (w mod (e+r)=0) and (q+w div (e+r)=24) then begin writeln(1); halt; end;
if (e0) and ((q+w) mod (e+r)=0) and ((q+w) div (e+r)=24) then begin writeln(1); halt; end;
if (e0) and (w mod e=0) and (q+w div e-r=24) then begin writeln(1); halt; end;
if (e0) and (w mod (e-r)=0) and (q+w div (e-r)=24) then begin writeln(1); halt; end;
if (e0) and ((q+w) mod (e-r)=0) and ((q+w) div (e-r)=24) then begin writeln(1); halt; end;
if (e0) and ((q+w) mod e=0) and ((q+w div e)-r=24) then begin writeln(1); halt; end;
if (e0) and (w mod e=0) and (q+(w div e)*r=24) then begin writeln(1); halt; end;
if ((e*r)0) and (w mod e=0) and ((w div e) mod r=0) and (q+((w div e) div r)=24) then begin writeln(1); halt; end;
if q-w+e+r=24 then begin writeln(1); halt; end;
if q-w+e-r=24 then begin writeln(1); halt; end;
if q-w+e*r=24 then begin writeln(1); halt; end;
if (r0) and (e mod r=0) and (q-w+e div r=24) then begin writeln(1); halt; end;
if (r0) and ((w+e) mod r=0) and (q-(w+e) div r=24) then begin writeln(1); halt; end;
if q-w-e+r=24 then begin writeln(1); halt; end;
if q-w-e-r=24 then begin writeln(1); halt; end;
if q-w-e*r=24 then begin writeln(1); halt; end;
if (q-w-e)*r=24 then begin writeln(1); halt; end;
if q-(w-e)*r=24 then begin writeln(1); halt; end;
if (r0) and (e mod r=0) and (q-w-e div r=24) then begin writeln(1); halt; end;
if (r0) and ((w-e) mod r=0) and (q-(w-e) div r=24) then begin writeln(1); halt; end;
if (r0) and ((q-w-e) mod r=0) and ((q-w-e) div r=24) then begin writeln(1); halt; end;
if q-w*e+r=24 then begin writeln(1); halt; end;
if q-w*e-r=24 then begin writeln(1); halt; end;
if q-w*e*r=24 then begin writeln(1); halt; end;
if (q-w)*e*r=24 then begin writeln(1); halt; end;
if (q-w*e)*r=24 then begin writeln(1); halt; end;
if (r0) and ((e*w) mod r=0) and (q-w*e div r=24) then begin writeln(1); halt; end;
if (r0) and ((e*(q-w)) mod r=0) and ((q-w)*e div r=24) then begin writeln(1); halt; end;
if (r0) and ((q-e*w) mod r=0) and ((q-w*e) div r=24) then begin writeln(1); halt; end;
if (e0) and (w mod e=0) and (q-w div e+r=24) then begin writeln(1); halt; end;
if (e0) and (w mod (r+e)=0) and (q-w div (e+r)=24) then begin writeln(1); halt; end;
if (e0) and (w mod e=0) and (q-w div e-r=24) then begin writeln(1); halt; end;
if (e0) and (w mod (e-r)=0) and (q-w div (e-r)=24) then begin writeln(1); halt; end;
if (e0) and (w mod e=0) and (q-(w div e)*r=24) then begin writeln(1); halt; end;
if (e0) and ((q-w) mod e=0) and ((q-w) div e*r=24) then begin writeln(1); halt; end;
if ((e*r)0) and (w mod e=0) and ((w div e) mod r=0) and (q-((w div e) div r)=24) then begin writeln(1); halt; end;
if ((e*r)0) and ((q-w) mod e=0) and (((q-w) div e) mod r=0) and (((q-w) div e) div r=24) then begin writeln(1); halt; end;
if q*w+e+r=24 then begin writeln(1); halt; end;
if q*w+e-r=24 then begin writeln(1); halt; end;
if q*(w+e)-r=24 then begin writeln(1); halt; end;
if q*w+e*r=24 then begin writeln(1); halt; end;
if (r0) and (e mod r=0) and (q*w+e div r=24) then begin writeln(1); halt; end;
if (r0) and ((w+e) mod r=0) and (q*(w+e) div r=24) then begin writeln(1); halt; end;
if q*w-e+r=24 then begin writeln(1); halt; end;
if q*w-e-r=24 then begin writeln(1); halt; end;
if q*w-e*r=24 then begin writeln(1); halt; end;
if q*(w-e)*r=24 then begin writeln(1); halt; end;
if (r0) and (e mod r=0) and (q*w-e div r=24) then begin writeln(1); halt; end;
if (r0) and (e mod r=0) and (q*w-e div r=24) then begin writeln(1); halt; end;
if (r0) and ((w-e) mod r=0) and (q*(w-e) div r=24) then begin writeln(1); halt; end;
if q*w*e+r=24 then begin writeln(1); halt; end;
if q*w*e-r=24 then begin writeln(1); halt; end;
if q*w*e*r=24 then begin writeln(1); halt; end;
if (r0) and ((q*w*e) mod r=0) and (q*w*e div r=24) then begin writeln(1); halt; end;
if (e0) and (w mod e=0) and (q*w div e+r=24) then begin writeln(1); halt; end;
if (e0) and (w mod e=0) and (q*w div e-r=24) then begin writeln(1); halt; end;
if (e0) and (w mod (e+r)=0) and (q*w div (e+r)=24) then begin writeln(1); halt; end;
if (e0) and (w mod (e-r)=0) and (q*w div (e-r)=24) then begin writeln(1); halt; end;
if (e0) and (w mod e=0) and (q*(w div e)*r=24) then begin writeln(1); halt; end;
if (e0) and (r0) and (w mod e=0) and ((w div e) mod r=0) and (q*((w div e) div r)=24) then begin writeln(1); halt; end;
if (w0) and (q mod w=0) and (q div w+e+r=24) then begin writeln(1); halt; end;
if (w0) and (q mod (w+e+r)=0) and (q div (w+e+r)=24) then begin writeln(1); halt; end;
if (w0) and (q mod w=0) and (q div w+e-r=24) then begin writeln(1); halt; end;
if (w0) and (q mod (w+e)=0) and (q div (w+e)-r=24) then begin writeln(1); halt; end;
if (w0) and (q mod w=0) and (q div w+e*r=24) then begin writeln(1); halt; end;
if (w0) and (r0) and (q mod w=0) and (e mod r=0) and (q div w+e div r=24) then begin writeln(1); halt; end;
if (w0) and (r0) and (q mod (w+e)=0) and ((q div (w+e)) mod r=0) and (q div (w+e) div r=24) then begin writeln(1); halt; end;
if (w0) and (q mod w=0) and (q div w-e+r=24) then begin writeln(1); halt; end;
if (w0) and (q mod w=0) and (q div w-e-r=24) then begin writeln(1); halt; end;
if (w0) and (q mod (w-e)=0) and (q div (w-e)-r=24) then begin writeln(1); halt; end;
if (w0) and (q mod (w-e-r)=0) and (q div (w-e-r)=24) then begin writeln(1); halt; end;
if (w0) and (q mod w=0) and (q div w-e*r=24) then begin writeln(1); halt; end;
if (w0) and (q mod (w-e)=0) and (q div (w-e)*r=24) then begin writeln(1); halt; end;
if (w0) and (r0) and (q mod w=0) and (e mod r=0) and (q div w-e div r=24) then begin writeln(1); halt; end;
if (w0) and (r0) and (q mod w=0) and ((q div (w-e)) mod r=0) and (q div (w-e) div r=24) then begin writeln(1); halt; end;
if (w0) and (q mod w=0) and (q div w*e+r=24) then begin writeln(1); halt; end;
if (w0) and (q mod w=0) and (q div w*e-r=24) then begin writeln(1); halt; end;
if (w0) and (q mod w=0) and (q div w*(e-r)=24) then begin writeln(1); halt; end;
if (w0) and (q mod w=0) and (q div w*e*r=24) then begin writeln(1); halt; end;
if (w0) and (r0) and (q mod w=0) and (e mod r=0) and (q div w*e div r=24) then begin writeln(1); halt; end;
if (w0) and (e0) and (q mod w=0) and ((q div w) mod e=0) and (q div w div e+r=24) then begin writeln(1); halt; end;
if (w0) and (e0) and (q mod w=0) and ((q div w) mod e=0) and (q div w div e-r=24) then begin writeln(1); halt; end;
if (w0) and (e-r0) and (q mod w=0) and ((q div w) mod (e-r)=0) and (q div w div (e-r)=24) then begin writeln(1); halt; end;
if (w0) and (e0) and (q mod w=0) and ((q div w) mod e=0) and (q div w div e*r=24) then begin writeln(1); halt; end;
if (w0) and (e0) and (r0) and (q mod w=0) and ((q div w) mod e=0) and (((q div w) div e) mod r=0) and (q div w div e div r=24) then begin writeln(1); halt; end;
end;
procedure work;
begin
find(a[1],a[2],a[3],a[4]);
find(a[1],a[2],a[4],a[3]);
find(a[1],a[3],a[2],a[4]);
find(a[1],a[3],a[4],a[2]);
find(a[1],a[4],a[2],a[3]);
find(a[1],a[4],a[3],a[2]);
find(a[2],a[1],a[3],a[4]);
find(a[2],a[1],a[4],a[3]);
find(a[2],a[3],a[1],a[4]);
find(a[2],a[3],a[4],a[1]);
find(a[2],a[4],a[1],a[3]);
find(a[2],a[4],a[3],a[1]);
find(a[3],a[1],a[2],a[4]);
find(a[3],a[1],a[4],a[2]);
find(a[3],a[2],a[1],a[4]);
find(a[3],a[2],a[4],a[1]);
find(a[3],a[4],a[2],a[1]);
find(a[3],a[4],a[1],a[2]);
find(a[4],a[1],a[2],a[3]);
find(a[4],a[1],a[3],a[2]);
find(a[4],a[2],a[1],a[3]);
find(a[4],a[2],a[3],a[1]);
find(a[4],a[3],a[2],a[1]);
find(a[4],a[3],a[1],a[2]);
writeln(0);
end;
begin
init;
work;
end. -
02008-08-27 23:25:27@
我编了一个无敌计算函数……
float yunsuan(float a,float b,int c)
{
if(c==1) return a+b;
if(c==2) return a-b;
if(c==3) return a*b;
if(c==4) return a/b;
if(c==5) return -a-b;
if(c==6) return b-a;
}
我想大概就这几种情况,c从1循环到6一直搜索……结果还没超时~~ -
02008-08-27 21:26:22@
random测RP的好题
-
02008-08-17 09:50:22@
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0ms小 搜 一 下
-
02008-08-16 13:46:33@
练搜索
-
02008-08-11 14:21:25@
好一道浪费时间的题
-
02008-08-09 16:27:48@
好题!
-和/时特殊处理!佩服佩服! -
02008-08-08 21:53:58@
注意读入时的区分,另外随机化可以简化编程复杂度.
-
02008-08-06 08:03:26@
除的时候除数+0.000000001
避免被零除。。。。。。。。。。。。。。
我wa了n次。。。。。。。。。。。。。。。。。。。。。 -
02008-07-22 10:54:16@
居然AC了,不可思议!!!
o(∩_∩)o... -
02007-12-09 15:31:36@
那个7重循环明显错的- -A A 2 7就过不了
-
02007-11-24 14:33:39@
对于此题,没有其他想法。
大家看看sy19920114大牛的题解(在本网页上直接查找)。
呵呵。。 -
02007-11-09 20:19:17@
我认为可以分为4种情况
1.没有括号的运算 (分步计算,无先后顺序)
2.(a+b)(c+d)
3.a/(b+c)+d
4.a/(b+c+d)
象d*(a+b+c) 就等于第一种的a+b+c*d
大家认为这个方法对不对?
[red]程序还没编译出来 -
02007-11-07 06:41:14@
每个数字顺序的穷举+每个符号的穷举
-
02007-10-27 19:12:56@
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0ms看起来挺简单,做起来还真烦,顺便BS一下CHEAT的人。
-
02007-10-27 09:13:03@
我楼下很Bt一个
-
02007-09-21 19:59:59@
..纪念一下..本题提交时验证码为18kb
-
02007-09-16 19:33:27@
饿。。。 交了三次。通过率阿