题意:给定三个数,让你放上+-*三种符号,使得他们的值最小。

析:没什么好说的,全算一下就好。肯定用不到加,因为是非负数。

代码如下:

#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <cstring>
#include <set>
#include <queue>
#include <algorithm>
#include <vector>
#include <map>
#include <cctype>
#include <cmath>
#include <stack>
#define frer freopen("in.txt", "r", stdin)
#define frew freopen("out.txt", "w", stdout)
using namespace std; typedef long long LL;
typedef pair<int, int> P;
const int INF = 0x3f3f3f3f;
const double inf = 0x3f3f3f3f3f3f;
const double PI = acos(-1.0);
const double eps = 1e-8;
const int maxn = 8;
const int mod = 1e9 + 7;
const char *mark = "+-*";
const int dr[] = {-1, 0, 1, 0};
const int dc[] = {0, 1, 0, -1};
int n, m;
const int mon[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
const int monn[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
inline int Min(int a, int b){ return a < b ? a : b; }
inline int Max(int a, int b){ return a > b ? a : b; }
inline LL Min(LL a, LL b){ return a < b ? a : b; }
inline LL Max(LL a, LL b){ return a > b ? a : b; }
inline bool is_in(int r, int c){
return r >= 0 && r < n && c >= 0 && c < m;
} int main(){
int a, b, c;
while(scanf("%d %d %d", &a, &b, &c) == 3){
int ans = a - b * c;
ans = Min(ans, b - a * c);
ans = Min(ans, c - a * b);
ans = Min(ans, a - b - c);
ans = Min(ans, b - a - c);
ans = Min(ans, c - b - a);
printf("%d\n", ans);
}
return 0;
}

  

  

URAL 2066 Simple Expression (水题,暴力)的更多相关文章

  1. ural 2066. Simple Expression

    2066. Simple Expression Time limit: 1.0 secondMemory limit: 64 MB You probably know that Alex is a v ...

  2. URAL 1136 Parliament 二叉树水题 BST后序遍历建树

    二叉树水题,特别是昨天刚做完二叉树用中序后序建树,现在来做这个很快的. 跟昨天那题差不多,BST后序遍历的特型,找到最后那个数就是根,向前找,比它小的那块就是他的左儿子,比它大的那块就是右儿子,然后递 ...

  3. POJ 1013 小水题 暴力模拟

    Counterfeit Dollar Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 35774   Accepted: 11 ...

  4. hdu 2066 最短路水题

    题意:给出多个可选择的起始点和终点,求最短路 思路:执行起始点次的spfa即可 代码: #include<iostream> #include<cstdio> #include ...

  5. [Usaco2008 Feb]Line连线游戏[暴力][水题]

    Description Farmer John最近发明了一个游戏,来考验自命不凡的贝茜.游戏开始的时 候,FJ会给贝茜一块画着N (2 <= N <= 200)个不重合的点的木板,其中第i ...

  6. DFS水题 URAL 1152 False Mirrors

    题目传送门 /* 题意:一个圈,每个点有怪兽,每一次射击能消灭它左右和自己,剩余的每只怪兽攻击 搜索水题:sum记录剩余的攻击总和,tot记录承受的伤害,当伤害超过ans时,结束,算是剪枝吧 回溯写挫 ...

  7. POJ 3468 A Simple Problem with Integers(线段树水题)

    A Simple Problem with Integers Time Limit: 5000MS   Memory Limit: 131072K Total Submissions: 135904 ...

  8. codeforce A. 2Char(水题,暴力)

    今晚发了个蛇精病,然后CF了,第一题这好难啊,然而水题一个,暴力飘过. 链接http://codeforces.com/contest/593/problem/A: 题意比较难懂吗?傻逼百度都翻译不对 ...

  9. URAL - 1917 Titan Ruins: Deadly Accuracy(水题)

    水题一个,代码挫了一下: 题意不好理解. 你去一个洞窟内探险,洞窟内有许多宝石,但都有魔法守护,你需要用魔法将它们打下来. 每个宝石都有自己的防御等级,当你的魔法超过它的防御等级时它就会被你打下来. ...

随机推荐

  1. Junit单元测试的实例

    进行单元测试的代码 package JunitTest; import org.junit.Test; public class Calculator { private static int res ...

  2. POJ 1681 Painter's Problem (高斯消元 枚举自由变元求最小的步数)

    题目链接 题意: 一个n*n 的木板 ,每个格子 都 可以 染成 白色和黄色,( 一旦我们对也个格子染色 ,他的上下左右 都将改变颜色): 给定一个初始状态 , 求将 所有的 格子 染成黄色 最少需要 ...

  3. ElasticSearch Remote Code Execution (CVE-2014-3120)

    Elasticsearch is a powerful open source search and analytics engine. The vulnerability allows attack ...

  4. BZOJ1272: [BeiJingWc2008]Gate Of Babylon

    题解: 多重集合的组合数?还是0-m?有些元素有个数限制? 多重集合的组合数可以插板法,0-m直接利用组合数的公式一遍求出来,个数限制注意到只有15个,那我们就暴力容斥了 AC了真舒畅.. 注意开lo ...

  5. 我是红领巾,分享2014 google不能用的方法。

    那啥已经20天打不开了. 得爬qiang. 今天无意间发现一个好东东. 特记录一下.    360浏览器设置 1.   工具菜单==>选项==>高级设置==>管理搜索引擎 . 2. ...

  6. Java [Leetcode 137]Single Number II

    题目描述: Given an array of integers, every element appears three times except for one. Find that single ...

  7. mysql违背了唯一约束

    执行一批数据,违背唯一约束时会中断,导致后面的数据写不进去. mysql有提供ignore关键字,使用insert ignore into .... 这样,当违背了唯一约束的时候~就会直接跳过,不会报 ...

  8. jquery插件——日历控件

    今天在网上有看到一个jquery插件——日历控件,不过之前也在柯乐义的网站上看到了(http://keleyi.com/ 推荐下) 这个插件看着比较大气,所以干脆也分享下,以后自己也好用一点儿 1.页 ...

  9. spring3.0.5的aop使用

    spring3.0.5开始支持jpa2.0了,但是最近笔者在使用他的的时候发现了3.0.5的包与2.5.5相比,有所精简.其他外部的包,我们需要自己下载. AOP必须的spring包 org.spri ...

  10. 【LR】关于宽带与比特之间的关系

    1.比特=bps 2M比特的意思是2宽带 1M宽带=12M比特=1*1024K比特=1*1024*1024比特=1057648比特 2M宽带=2*1024*1024比特=2097152比特 4M宽带= ...