King

【题目描述】

在某个国家,若想当上国王,须解决以下问题:

已知一个序列A1、A2、······、An,给定其若干子序列以及对该子序列的约束条件,例如:

Asi、Asi+1、Asi+2、······、Asi+ni,且Asi+Asi+1+Asi+2+······+Asi+ni </> ki

现询问是否存在满足以上m个要求的序列,是则输出“lamentable kingdom”,否则输出“successful conspiracy”。

【输入描述】

输入多组数据,每组数据输入格式如下:

第一行输入两个数n、m(n,m <= 100),分别表示序列长度和要求数目;

接下来m行,每行输入一个要求;

最后一行输入“0”,表示结束。

【输出描述】

对于每组数据,输出一行,表示答案。

【输入样例】

4 2

1 2 gt 0

2 2 lt 2

1 2

1 0 gt 0

1 0 lt 0

0

【输出样例】

lamentable kingdom

successful conspiracy

时间: 2024-08-11 21:43:13

King的相关文章

POJ2728 Desert King

Time Limit: 3000MS   Memory Limit: 65536KB   64bit IO Format: %lld & %llu Description David the Great has just become the king of a desert country. To win the respect of his people, he decided to build channels all over his country to bring water to

hdu 5640 King&#39;s Cake(模拟)

Problem Description It is the king's birthday before the military parade . The ministers prepared a rectangle cake of size n×m(1≤n,m≤10000) . The king plans to cut the cake himself. But he has a strange habit of cutting cakes. Each time, he will cut

[SCOI2005]互不侵犯King

1087: [SCOI2005]互不侵犯King Time Limit: 10 Sec  Memory Limit: 162 MB Submit: 4255  Solved: 2458 [Submit][Status][Discuss] Description 在N×N的棋盘里面放K个国王,使他们互不攻击,共有多少种摆放方案.国王能攻击到它上下左右,以及左上 左下右上右下八个方向上附近的各一个格子,共8个格子. Input 只有一行,包含两个数N,K ( 1 <=N <=9, 0 <=

01分数规划+prim POJ2728 Desert King

Desert King Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 26009   Accepted: 7219 Description David the Great has just become the king of a desert country. To win the respect of his people, he decided to build channels all over his coun

POJ3682 King Arthur&#39;s Birthday Celebration

King Arthur is an narcissist who intends to spare no coins to celebrate his coming K-th birthday. The luxurious celebration will start on his birthday and King Arthur decides to let fate tell when to stop it. Every day he will toss a coin which has p

hdu_5314_Happy King(树的点分治)

题目链接:hdu_5314_Happy King 题意: 给出一颗n个结点的树,点上有权值: 求点对(x,y)满足x!=y且x到y的路径上最大值与最小值的差<=D: 题解: 还是树的点分治,在统计答案的时候先按到根的最小值排序,然后用最大值减D去找有多少个满足答案. 1 #include<bits/stdc++.h> 2 #define F(i,a,b) for(int i=a;i<=b;++i) 3 using namespace std; 4 typedef pair<i

codeforces 710A A. King Moves(水题)

题目链接: A. King Moves 题意: 给出king的位置,问有几个可移动的位置; 思路: 水题,没有思路; AC代码: #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> #include <bits/stdc++.h> #include <stack> #include &l

hdu 5641 King&#39;s Phone(暴力模拟题)

Problem Description In a military parade, the King sees lots of new things, including an Andriod Phone. He becomes interested in the pattern lock screen. The pattern interface is a 3×3 square lattice, the three points in the first line are labeled as

hdu 5642 King&#39;s Order

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5642 题意:给出一个n,问一个长度为n的只含有小写字母的序列中,满足其中不含有超过3个连续相同字母的序列的个数有多少. 思路: 设dp[i][j],表示序列第i位为字母j的合法序列的个数.sum[i]表示长度为i的序列有多少个. 假设第i位为字母'a',dp[i][j]就是sum[i-1]*1-不合法的情况. 不合法的情况就是sum[i-4] - dp[i-4][j]. sum[i-4]表示已经计算

King.com:如何疯狂赚钱?(转)

$King.com(KING)$ 最近笔者在手机上疯狂玩着一个游戏,名叫Candy Crush Saga(糖果粉碎传奇),一个消除类的休闲游戏.周围的朋友都很奇怪,问我怎么会去玩一个女生才玩的消除游戏?作为一个重度的游戏爱好者,顶着朋友们的 嘲笑,花时间在这样一个玩法简单.色彩艳丽的小游戏,实在是因为该游戏本身有着难以抗拒的魔力,也促使我在今天谈谈这款风靡全球的作品. 2011年中,游戏开发商King.com旗下一个五人团队着手开发一款实验游戏,取名叫Candy Crush Saga(糖果粉碎传