讨论 / 发布《24点》历史上最不要脸的揭发
qqqqqqq 2011-01-07 07:26:00
点我顶贴 收藏 删除
var

s:string;

begin

readln (s);

if (copy (s,1,3)=’A 2’) or

(copy (s,1,3)=’5 5’) or (copy (s,1,3)=’4 4’) or

(copy (s,1,3)=’3 3’) or (copy (s,1,3)=’1 2’) or

(copy (s,1,3)=’k k’)then writeln (’yes’) else writeln (’no’);

end.

绝对的简练^_^

#1 LIFE@2008-11-03 19:08:00
回复 删除
这叫CHEAT OK?
#2 Zx.MYS@2008-11-03 23:06:00
回复 删除
BS CHEAT

#3 飞雪天涯@2008-11-04 04:43:00
回复 删除
dfs:

/*

http://www.rqnoj.cn/Problem_Show.asp?PID=74

Show Problem

题目:24点 问题编号:74

My Flag:Unaccepted

题目类型 搜索

描述

superwyh是一个非常疯狂的24点爱好者,空闲时总是自己拿出扑克来算24点,24点的规则很简单,就是给你4张扑克(从

1至13,用A代替1,J代替11,Q代替12,K代替13)通过加减乘除来求得24,各位oier帮了superwyh好多忙,为了报答大家

superwyh就和大家做个24点的游戏,superwyh给大家4张牌大家告诉superwyh能不能凑成24就行。

[renqing PS:这道题很easy,是送分的题]

输入格式

4张牌的牌面(1<=n<=13)。

输出格式

如果能凑成输出"yes"反之输出"no"。

样例输入

A 2 3 4

样例输出

yes

*/

#include<iostream>

#include<string>

#include<cmath>

using namespace std;

string card="!A234567890JQK";

double pos[4];bool used[4];

bool dfs_try(int depth,double amount){

if (depth==4){

if (amount>23.999999&&amount<24.000001) return true;

else return false;

}

else{

for (int i=0;i<4;i++)

if (!used[i]){

used[i]=true;

if (dfs_try(depth+1,amount+pos[i])) return true;

if (dfs_try(depth+1,amount-pos[i])) return true;

if (dfs_try(depth+1,pos[i]-amount)) return true;

if (amount!=0&&dfs_try(depth+1,amount*pos[i])) return true;

if (amount!=0&&/*amount%pos[i]==0&&*/dfs_try(depth+1,amount/pos[i])) return true;

if (amount!=0&&/*pos[i]%amount==0&&*/dfs_try(depth+1,pos[i]/amount)) return true;

used[i]=false;

}

return false;

}

}

int main (void){

string c;

for (int i=0;i<4;i++){

cin>>c;if (c=="10")c="0";

if (c=="1") c="A";

pos[i]=(double)card.find(c);

used[i]=false;

}

if (dfs_try(0,0)==true)cout<<"yes";

else cout<<"no";

//while(1);

return 0;

}

#4 zjh0128@2010-03-02 17:46:00
回复 删除
fp 的这个代码是什么原理啊……看不懂了!!
#5 tzh@2010-08-16 06:00:00
回复 删除
靠,竟然有数据

如题

楼主牛

#6 銀翼的魔術師@2010-11-06 19:54:00
回复 删除
BS
#7 SkipperFinal@2011-01-04 05:41:00
回复 删除
...
#8 zhumingjie10@2011-01-07 07:26:00
回复 删除
饿。。。AJQK可以小写吗?

难怪我的程序被和谐了。。。

查看更多回复
提交回复