poj3983 (24点)
摘要:
给出4个数,只能添加+-*/或者()使得结果为24。思路:枚举,一共5*3^4.#include <iostream>using namespace std;double a,b,c,d;double f(double a,double b,int op){ if(1 == op) return a+b; if(2 == op) return a-b; if(3 == op) return a*b; return a/b;}//type表示加括号的方式,一共5种bool caculate(int p1,int p2,int p3,int type){ double ans=0.0; 阅读全文
posted @ 2011-11-10 21:56 buptLizer 阅读(795) 评论(0) 推荐(0) 编辑