Poj 3062 Celebrity jeopardy

1.Link:

http://poj.org/problem?id=3062

2.Content:

Celebrity jeopardy

Time Limit: 1000MS   Memory Limit: 65536K
Total Submissions: 15015   Accepted: 8471

Description

It‘s hard to construct a problem that‘s so easy that everyone will get it, yet still difficult enough to be worthy of some respect. Usually, we err on one side or the other. How simple can a problem really be?

Here, as in Celebrity Jepoardy, questions and answers are a bit confused, and, because the participants are elebrities, there’s a real need to make the challenges simple. Your program needs to prepare a question to be solved --- an equation to be solved --- given the answer. Specifically, you have to write a program which finds the simplest possible equation to be solved given the answer, considering all possible equations using the standard mathematical symbols in the usual manner. In this context, simplest can be defined unambiguously several different ways leading to the same path of resolution. For now, find the equation whose transformation into the desired answer requires the least effort.

For example, given the answer X = 2, you might create the equation 9 - X = 7. Alternately, you could build the system X > 0; X^2 = 4. These may not be the simplest possible equations. Solving these mind-scratchers might be hard for a celebrity.

Input

Each input line contains a solution in the form <symbol> = <value>

Output

For each input line, print the simplest system of equations which would to lead to the provided solution, respecting the use of space exactly as in the input.

Sample Input

Y = 3
X=9

Sample Output

Y = 3
X=9

Source

Southeastern Europe 2006

3.Method:

4.Code:

1 #include<iostream>
2 #include <cstdio>
3 using namespace std;
4 int main()
5 {
6     char a[100];
7     while(gets(a))    puts(a);
8     return 0;
9 }

5.Reference:

时间: 2024-12-21 06:40:42

Poj 3062 Celebrity jeopardy的相关文章

TJU Problem 2548 Celebrity jeopardy

下次不要被长题目吓到,其实不一定难. 先看输入输出,再揣测题意. 原文: 2548.   Celebrity jeopardy Time Limit: 1.0 Seconds   Memory Limit: 65536KTotal Runs: 1306   Accepted Runs: 898 It's hard to construct a problem that's so easy that everyone will get it, yet still difficult enough

POJ - 3062 Borg Maze

题目链接:http://poj.org/problem?id=3026 Svenskt Masterskap我程序员/ Norgesmesterskapet 2001 Description The Borg is an immensely powerful race of enhanced humanoids from the delta quadrant of the galaxy. The Borg collective is the term used to describe the g

【POJ 3062】Party(2-SAT、tarjan)

2-SAT的入门题. a,a',b,b'分别表示两对夫妇,如果a,b有矛盾,那么a要来,就只能来b',b要来,就只能来a'.于是建了两条边(a,b'),(b,a'). 用tarjan强连通分量缩点染色后,如果同一对夫妇染色相同,说明两个要么都来,要么都不来,就不可能有解了.否则,形成的强连通分量中必定是对称的(abc是强连通分量,那么a'b'c'也会在一个强连通分量里),于是只要选择几个强连通分量就可以每个集合都选1个. #include <cstdio> #include <cstri

POJ百道水题列表

以下是poj百道水题,新手可以考虑从这里刷起 搜索1002 Fire Net1004 Anagrams by Stack1005 Jugs1008 Gnome Tetravex1091 Knight Moves1101 Gamblers1204 Additive equations 1221 Risk1230 Legendary Pokemon1249 Pushing Boxes 1364 Machine Schedule1368 BOAT1406 Jungle Roads1411 Annive

HDU 3062 &amp;&amp; HDU 1824 &amp;&amp; POJ 3578 &amp;&amp; BZOJ 1997 2-SAT

一条边<u,v>表示u选那么v一定被选. 1 #include <iostream> 2 #include <cstring> 3 #include <cstdio> 4 #include <algorithm> 5 using namespace std; 6 const int Maxm=21000; 7 const int Maxn=2010; 8 struct EDGE{int to,next;}edge[Maxm]; 9 int T,m

poj水题-3062 超级水题的深层理解——代码简化

题目很简单,要求输入什么样输出什么样.以回车结束 这就是我用的C代码 #include <stdio.h> int main (){char p;for(;gets(&p);)puts(&p);return 0;} 使用了代码简化方案,我简化到了75B.有大神简化到31B,真想看看他们的源代码.我估计他们比我个能够了解语言规则. 这里不得不说一本叫<短码之美>的书.介绍了这道题.但我试过了,没用.可能系统升级了吧,必须要求C99. ,还听说不用#include也行,

图论 500题——主要为hdu/poj/zoj

转自——http://blog.csdn.net/qwe20060514/article/details/8112550 =============================以下是最小生成树+并查集======================================[HDU]1213   How Many Tables   基础并查集★1272   小希的迷宫   基础并查集★1325&&poj1308  Is It A Tree?   基础并查集★1856   More i

POJ - 3186 Treats for the Cows (区间DP)

题目链接:http://poj.org/problem?id=3186 题意:给定一组序列,取n次,每次可以取序列最前面的数或最后面的数,第n次出来就乘n,然后求和的最大值. 题解:用dp[i][j]表示i~j区间和的最大值,然后根据这个状态可以从删前和删后转移过来,推出状态转移方程: dp[i][j]=max(dp[i+1][j]+value[i]*k,dp[i][j-1]+value[j]*k) 1 #include <iostream> 2 #include <algorithm&

POJ 2533 - Longest Ordered Subsequence(最长上升子序列) 题解

此文为博主原创题解,转载时请通知博主,并把原文链接放在正文醒目位置. 题目链接:http://poj.org/problem?id=2533 Description A numeric sequence of ai is ordered if a1 < a2 < ... < aN. Let the subsequence of the given numeric sequence (a1, a2, ..., aN) be any sequence (ai1, ai2, ..., aiK)