Codeforces Round #241 (Div. 2) A
来源:互联网 发布:.wang域名 编辑:程序博客网 时间:2024/05/16 08:22
题目链接:A. Guess a number!
题意:给定一些式子,求出满足范围的任意一个y。
思路:水题,模拟题意即可
代码:
#include <stdio.h>#include <string.h>#include <string>#include <iostream>using namespace std;#define INF 0x3f3f3f3fint q, num, flag = 1, down, up;string s1, s2;int main() { cin >> q; down = -INF; up =INF; while (q--) { cin >> s1 >> num >> s2; if (s1 == ">=" && s2 == "Y") { if (down < num) down = num; } if (s1 == ">" && s2 == "Y") { if (down <= num) down = num + 1; } if (s1 == "<=" && s2 == "Y") { if (up > num) up = num; } if (s1 == "<" && s2 == "Y") { if (up >= num) up = num - 1; } if (s1 == ">=" && s2 == "N") { if (up >= num) up = num - 1; } if (s1 == ">" && s2 == "N") { if (up > num) up = num; } if (s1 == "<=" && s2 == "N") { if (down <= num) down = num + 1; } if (s1 == "<" && s2 == "N") { if (down < num) down = num; } } if (down > up) printf("Impossible\n"); else printf("%d\n", down); return 0;}
0 0
- Codeforces Round #241 (Div. 2) A
- Codeforces Round #241 (Div. 2) A
- Codeforces Round #241 (Div. 2) A
- Codeforces Round #241 (Div. 2) A~C
- Codeforces Round #241 (Div. 2) A题
- Codeforces Round #241 (Div. 2) A. Guess a number!
- Codeforces Round #241 (Div. 2)-A. Guess a number!
- Codeforces Round #241 (Div. 2) A B C题解
- Codeforces Round #241 (Div. 2) AGuess a number!
- Codeforces Round #131 (Div. 2) A B
- Codeforces Round #174 (Div. 2) Problem A
- Codeforces Round #173 (Div. 2) A.Bit++
- Codeforces Round #181 (Div. 2) A题
- Codeforces Round #184 (Div. 2) A题
- Codeforces Round #185 (Div. 2)--A,B
- Codeforces Round #172 (Div. 2) A题
- Codeforces Round #166 (Div. 2) A题
- Codeforces Round #132 (Div. 2) A题
- Codeforces Round #241 (Div. 2)
- 垃圾外链对网站真的没有好处吗?
- MFC 实现图片的拖拽功能,代码很详细,贴过去就能用!
- 利用FutureTask进行线程并发操作
- 2014找工作----扎实的基础和开阔的视野是企业最看重的因素
- Codeforces Round #241 (Div. 2) A
- 插入排序的实现
- Linux 自旋锁
- 汇编语言关于mov al,[0]的有关问题
- get/post类
- Codeforces Round #241 (Div. 2) B
- INTERVAL 用法
- 线程池
- solr+tomcat例子