621 - Secret Research
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的更多相关文章
- UVA题目分类
题目 Volume 0. Getting Started 开始10055 - Hashmat the Brave Warrior 10071 - Back to High School Physics ...
- Volume 1. Maths - Misc
113 - Power of Cryptography import java.math.BigInteger; import java.util.Scanner; public class Main ...
- poj3708(公式化简+大数进制装换+线性同余方程组)
刚看到这个题目,有点被吓到,毕竟自己这么弱. 分析了很久,然后发现m,k都可以唯一的用d进制表示.也就是用一个ai,和很多个bi唯一构成. 这点就是解题的关键了. 之后可以发现每次调用函数f(x),相 ...
- poj 3708 Recurrent Function
Recurrent Function Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 1233 Accepted: 336 ...
- PHP serialize && unserialize Security Risk Research
目录 . 序列化的定义 . serialize:序列化 . unserialize:反序列化 . 序列化.反序列化存在的安全风险 . Use After Free Vulnerability -] . ...
- 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 ...
- 【oneday_onepage】——The Secret Of Steve<1>
The Secret Of SteveThe secret of Steve is simple. It explains his success and excess. It exemplifies ...
- Android Secret Code
我们很多人应该都做过这样的操作,打开拨号键盘输入*#*#4636#*#*等字符就会弹出一个界面显示手机相关的一些信息,这个功能在Android中被称为android secret code,除了这些系 ...
- ASP.NET OAuth:access token的加密解密,client secret与refresh token的生成
在 ASP.NET OWIN OAuth(Microsoft.Owin.Security.OAuth)中,access token 的默认加密方法是: 1) System.Security.Crypt ...
随机推荐
- APNs原理解析
什么是APNs 先说一下远程推送,一般我们有自己的服务器,在这个过程中是Provider的角色,如图,推送从我们的服务器到我们的APP的过程就是要通过APNs来发送 APNs(Apple Push N ...
- HTTPS的学习总结
HTTPS学习总结 简述 HTTPS对比HTTP就多了一个安全层SSL/TLS,具体就是验证服务端的证书和对内容进行加密. 先来看看HTTP和HTTPS的区别 我用AFN访问http下的httpbin ...
- 转: 让html5标签在ie8及以下的被正确解析的解决方案
最近仿的几个主题中,有几个是采用html5语法制作的,html5嘛,以后必然大势所趋,但是现有的很多浏览器并不支持这种新的标准. 而我制作网站习惯用的是chrome浏览器的,当然不存在不兼容问题了. ...
- 这些屌炸天的创业者为何对投资人说NO
曾有人说,世上的创业者只分为两种,一种是找到投资的,一种是没有找到的. 但其实还有第三种,就是那些拒绝了投资人的创业者. 他们摒弃了投资人抛来的橄榄枝,并非不差钱,不接受投资的原因大体出于两个方面,一 ...
- thinkphp 常用的查询
php 常用的数据库查询方式: //根据where 条件查询,使用select()方法 访问:http://localhost/thinkphp2/index.php/Machine/search_i ...
- cocos2dx进阶学习之CCSprite
继承关系 CCSprite -> CCNodeRGBA -> CCNode, CCRGBAProtocol CCTextureProtocol 从继承关系可以看出,CCSp ...
- 在UITouch事件中画圆圈-iOS8 Swift基础教程
这篇教程主要内容展示如何利用Core Graphics Framework画圆圈,当用户点击屏幕时随机生成不同大小的圆,这篇教程在Xcode6和iOS8下编译通过. 打开Xcode,新建项目选择Sin ...
- spark sql 以JDBC为数据源
一.环境准备: 安装mysql后,进入mysql命令行,创建测试表.数据: 将 mysql-connector-java 的jar文件拷贝到 \spark_home\lib\下,你可以使用最新版本,下 ...
- pkg_utility
创建包名: CREATE OR REPLACE PACKAGE BODY PKG_UTILITY AS --字符串转换到索引表 PROCEDURE STR_TO_LIST(PI_STR IN VARC ...
- Js 30 BOM
小知识点, 1.document.write()方法: 如果document.write()在一个事件中或window.onload=function(){}这个function里, 那么docume ...