博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
poj4012
阅读量:6913 次
发布时间:2019-06-27

本文共 1310 字,大约阅读时间需要 4 分钟。

简单题

判断的情况稍微有点复杂,注意判断整行都是“.”的情况

View Code
#include 
#include
#include
#include
#include
using namespace std;#define maxn 5005int n, m, s, k;char st[maxn];int cal(int a){ if (a < 0) return 0; return a;}int main(){ scanf("%d%d%d%d", &m, &n, &s, &k); scanf("%s", st); int pos = find(st, st + n, '*') - st; if (pos == n) { if (k < s + 1 && m - k < s) { printf("Impossible\n"); return 0; } if (n > s || cal(k - s) + cal(m - k - s + 1) > 1) { printf("Ambiguous\n"); return 0; } printf("Unique\n"); return 0; } if (pos + s > n) { printf("Impossible\n"); return 0; } int pos1 = find(st + pos, st + pos + s, '.') - (st + pos); if (pos1 != s) { printf("Impossible\n"); return 0; } int pos2 = find(st + pos + s, st + n, '*') - st; if (pos2 != n) { printf("Impossible\n"); return 0; } if (k == 1 || k == m || s == 1 || s == m) { printf("Unique\n"); return 0; } printf("Ambiguous\n"); return 0;}

转载于:https://www.cnblogs.com/rainydays/archive/2012/10/19/2731746.html

你可能感兴趣的文章
C#中ref和out的使用小结
查看>>
Extjs4 中的gird
查看>>
错排-HDU 2049 递推的应用
查看>>
参数化查询为什么能够防止SQL注入
查看>>
AlertDialog.Builder弹出对话框
查看>>
HDUOJ -----1686
查看>>
pomelo组件..
查看>>
[问题2014S03] 解答
查看>>
mybatis入门例子
查看>>
[LeetCode] Construct Binary Tree from Inorder and Postorder Traversal
查看>>
Sencha touch 初体验
查看>>
锋利的jQuery-1--解决jquery库和其他库的冲突
查看>>
SSH框架
查看>>
第1章 游戏之乐——小飞的电梯调度算法
查看>>
Codeforces Round #256 (Div. 2) C. Painting Fence 或搜索DP
查看>>
component to string 自定义窗体
查看>>
Atitit.收银系统模块架构attilax 总结
查看>>
hibernate(十)双向关联关系的CRUD
查看>>
hadoop学习;大数据集在HDFS中存为单个文件;安装linux下eclipse出错解决;查看.class文件插件...
查看>>
SolrCloud-5.2.1 集群部署及测试
查看>>