Secret Research 

At a certain laboratory results of secret research are thoroughly encrypted. A result of a single experiment is stored as an information of its completion:

`positive result',`negative result',`experiment failed' or`experiment not completed'

The encrypted result constitutes a string of digits S, which may take one of the following forms:



positive result S = 1 or S = 4 or S = 78

negative result S = S35

experiment failed S = 9S4

experiment not completed S = 190S

(A sample result S35 means that if we add digits 35 from the right hand side to a digit sequence then we shall get the digit sequence corresponding to a failed experiment)

You are to write a program which decrypts given sequences of digits.

Input

A integer
n stating the number of encrypted results and thenconsecutive
n lines, each containing a sequence of digits given as ASCII strings.

Output

For each analysed sequence of digits the following lines should be sent to output (in separate lines):


+ for a positive result
- for a negative result
* for a failed experiment
? for a not completed experiment

In case the analysed string does not determine the experiment result, a first match from the above list should be outputted.

Sample Input

4
78
7835
19078
944

Sample Output

+
-
?
*
#include<stdio.h>
#include<string.h>
int main()
{
int n;
scanf("%d",&n);
while(n--)
{
char a[1005]={0};
scanf("%s",a);
if(strlen(a)<=2)
puts("+");
else if(a[strlen(a)-1]=='5'&&a[strlen(a)-2]=='3')
puts("-");
else if(a[0]=='9'&&a[strlen(a)-1]=='4')
puts("*");
else if(a[0]=='1'&&a[1]=='9'&&a[2]=='0')
puts("?");
}
return 0;
}

621 - Secret Research的更多相关文章

  1. UVA题目分类

    题目 Volume 0. Getting Started 开始10055 - Hashmat the Brave Warrior 10071 - Back to High School Physics ...

  2. Volume 1. Maths - Misc

    113 - Power of Cryptography import java.math.BigInteger; import java.util.Scanner; public class Main ...

  3. poj3708(公式化简+大数进制装换+线性同余方程组)

    刚看到这个题目,有点被吓到,毕竟自己这么弱. 分析了很久,然后发现m,k都可以唯一的用d进制表示.也就是用一个ai,和很多个bi唯一构成. 这点就是解题的关键了. 之后可以发现每次调用函数f(x),相 ...

  4. poj 3708 Recurrent Function

    Recurrent Function Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 1233   Accepted: 336 ...

  5. PHP serialize && unserialize Security Risk Research

    目录 . 序列化的定义 . serialize:序列化 . unserialize:反序列化 . 序列化.反序列化存在的安全风险 . Use After Free Vulnerability -] . ...

  6. The top 100 papers Nature explores the most-cited research of all time.

    The top 100 papers Nature explores the most-cited research of all time. The discovery of high-temper ...

  7. 【oneday_onepage】——The Secret Of Steve<1>

    The Secret Of SteveThe secret of Steve is simple. It explains his success and excess. It exemplifies ...

  8. Android Secret Code

    我们很多人应该都做过这样的操作,打开拨号键盘输入*#*#4636#*#*等字符就会弹出一个界面显示手机相关的一些信息,这个功能在Android中被称为android secret code,除了这些系 ...

  9. ASP.NET OAuth:access token的加密解密,client secret与refresh token的生成

    在 ASP.NET OWIN OAuth(Microsoft.Owin.Security.OAuth)中,access token 的默认加密方法是: 1) System.Security.Crypt ...

随机推荐

  1. mysql 添加[取消]timestamp的自动更新

    创建自动更新的 timestamp (插入或修改时 uptime都会自动更新) CREATE TABLE `hello` (`id` int(11) NOT NULL,`uptime` timesta ...

  2. (step4.2.1) hdu 1372(Knight Moves——BFS)

    解题思路:BFS 1)马的跳跃方向 在国际象棋的棋盘上,一匹马共有8个可能的跳跃方向,如图1所示,按顺时针分别记为1~8,设置一组坐标增量来描述这8个方向: 2)基本过程 设当前点(i,j),方向k, ...

  3. OracleDBConsoleorcl无法启动

    OracleDBConsoleorcl无法启动 向左转|向右转 提问者采纳  2010-10-13 19:40 我前几天刚解决了这个问题 这个错误原因是因为你的ip是动态获取的,你在安装Oracle时 ...

  4. MDK常见错误详解集合

    错误代码及错误信息 错误释义 error 1: Out of memory 内存溢出 error 2: Identifier expected 缺标识符 error 3: Unknown identi ...

  5. UILabel可以显示html文本

    NSString * htmlString = @"<html><body> Some html string \n <font size=\"13\ ...

  6. myeclipse8.5如何注册,转自他出

    Step: 1.建立一个任意名称的Java Project 2.在该工程中建立一个名文MyEclipseGen的Java文件(MyEclipseGen.java) 3.运行下面的代码,会在控制台出现& ...

  7. 机器学习笔记(三)- from Andrew Ng的教学视频

    week four: Non-linear hypotheses:Neural Networks -->x1 and x2 x1 XNOR x2 ->a1->x1 and x2;a2 ...

  8. 怎样让jQuery和其它js库共存

    怎样让jQuery和其它js库共存 有时候需要同时使用jQuery和其它javascript,比如在joomla中默认的是motools,但很多人还是希 望能够使用jQuery,如果直接调用的话,由于 ...

  9. 安装帝国CMS遇到“修改php.ini,将:short_open_tag 设为 On”的解决方法+“建立目录不成功!请检查目录权限”问题

    想用安装个帝国CMS来做个网站,于是下载了程序,上传到服务器上,但是在输入安装路径的时候却给出了如下图示: 您的PHP配置文件php.ini配置有问题,请按下面操作即可解决: 1.修改php.ini, ...

  10. iOS 获取字符串中的单个字符

    要取到单个字符,就要知道字符串的编码方式,这样才能够定位每个字符在内存中的位置.但是,iOS的字符串编码是不固定的,因此,需要设置一个统一的编码格式,将所有其他格式的字符串都转化为统一的格式,然后就可 ...