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. php返回的json格式

    public function search_ip(){ $where['ip'] = $_GET['ip']; $Machine = M('Machine_info'); $arr = $Machi ...

  2. java学习之二叉树的实现

    二叉树是一种数据结构,每个节点都有两个子节点. 二叉树的遍历有三种方式, 先序遍历是 根节点,左子树,右子树: 中序遍历是 左子树,根节点,右子树: 后序遍历是 左子树,右子树,根节点: java实现 ...

  3. BZOJ 1015

    program bzoj1015; {$inline on} ; type node=record togo,next:longint; end; var tot,n,m,d,cnt:longint; ...

  4. [置顶] mybatis批量新增系列之有主键的表的批量新增

    前面介绍了无主键的表的批量插入,文章地址:http://blog.csdn.net/zhouxiaoyun0228/article/details/9980181 但是在开发中往往许多的表是需要主键的 ...

  5. HTTP 教程 转自 http://www.w3cschool.cc/http/http-tutorial.html

    HTTP协议(HyperText Transfer Protocol,超文本传输协议)是因特网上应用最为广泛的一种网络传输协议,所有的WWW文件都必须遵守这个标准. HTTP是一个基于TCP/IP通信 ...

  6. Centos6.5快速配置可用网卡

    原文链接: Centos6.5快速配置可用网卡 安装完成后,我们启动我们的系统,此时我们的系统,是没有连网的,IP设备,并没有被激活,如果我们使用ifconfig命令查看IP地址,就会发现,此刻的地址 ...

  7. ASP.NET MVC 5 学习教程:Details 和 Delete 方法详解

    原文 ASP.NET MVC 5 学习教程:Details 和 Delete 方法详解 在教程的这一部分,我们将研究一下自动生成的 Details 和Delete 方法. Details 方法 打开M ...

  8. 基于visual Studio2013解决算法导论之045斐波那契堆

     题目 斐波那契堆 解决代码及点评 // 斐波那契堆.cpp : 定义控制台应用程序的入口点. // #include<iostream> #include<cstdio> ...

  9. 计算机中丢失MSVCP110.dll

    1.安装Microsoft visual c++ 2.下载MSVCP110.dll复制到C:\system32 3.使用DirectX修复工具

  10. zzuli Camellia的难题(暴力)

    1784: Camellia的难题 Time Limit: 2 Sec  Memory Limit: 128 MB Submit: 67  Solved: 14SubmitStatusWeb Boar ...