摘要: 本题要求实现一种数字加密方法。首先固定一个加密用正整数A,对任一正整数B,将其每1位数字与A的对应位置上的数字进行以下运算:对奇数位,对应位的数字相加后对13取余——这里用J代表10、Q代表11、K代表12;对偶数位,用B的数字减去A的数字,若结果为负数,则再加10。这里令个位为第1位。 输入格式: 阅读全文
posted @ 2018-03-12 10:35 王清河 阅读(212) 评论(0) 推荐(0)
摘要: Scientific notation is the way that scientists easily handle very large numbers or very small numbers. The notation matches the regular expression [+- 阅读全文
posted @ 2018-03-11 20:51 王清河 阅读(134) 评论(0) 推荐(0)
摘要: Sherlock Holmes received a note with some strange strings: "Let's date! 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk d&Hyscvnm". It took him only a min 阅读全文
posted @ 2018-03-11 15:58 王清河 阅读(114) 评论(0) 推荐(0)
摘要: 给定一句英语,要求你编写程序,将句中所有单词的顺序颠倒输出。 输入格式:测试输入包含一个测试用例,在一行内给出总长度不超过80的字符串。字符串由若干单词和若干空格组成,其中单词是由英文字母(大小写有区分)组成的字符串,单词之间用1个空格分开,输入保证句子末尾没有多余的空格。 输出格式:每个测试用例的 阅读全文
posted @ 2018-03-11 14:12 王清河 阅读(141) 评论(0) 推荐(0)
摘要: 读入一个自然数n,计算其各位数字之和,用汉语拼音写出和的每一位数字。 输入格式:每个测试输入包含1个测试用例,即给出自然数n的值。这里保证n小于10100。 输出格式:在一行内输出n的各位数字之和的每一位,拼音数字间有1 空格,但一行中最后一个拼音数字后没有空格。 输入样例: 12345678909 阅读全文
posted @ 2018-03-11 11:08 王清河 阅读(152) 评论(0) 推荐(0)
摘要: 一个合法的身份证号码由17位地区、日期编号和顺序编号加1位校验码组成。校验码的计算规则如下: 首先对前17位数字加权求和,权重分配为:{7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2};然后将计算的和对11取模得到值Z;最后按照以下关系对应Z值与校验码M的值: Z:0 1 2 阅读全文
posted @ 2018-03-11 10:52 王清河 阅读(216) 评论(0) 推荐(0)
摘要: 让我们用字母B来表示“百”、字母S表示“十”,用“12...n”来表示个位数字n(<10),换个格式来输出任一个不超过3位的正整数。例如234应该被输出为BBSSS1234,因为它有2个“百”、3个“十”、以及个位的4。 输入格式:每个测试输入包含1个测试用例,给出正整数n(<1000)。 输出格式 阅读全文
posted @ 2018-03-11 08:52 王清河 阅读(95) 评论(0) 推荐(0)
摘要: If you are a fan of Harry Potter, you would know the world of magic has its own currency system -- as Hagrid explained it to Harry, "Seventeen silver 阅读全文
posted @ 2018-03-10 19:28 王清河 阅读(125) 评论(0) 推荐(0)
摘要: People in Mars represent the colors in their computers in a similar way as the Earth people. That is, a color is represented by a 6-digit number, wher 阅读全文
posted @ 2018-03-10 19:10 王清河 阅读(165) 评论(0) 推荐(0)
摘要: A number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example, 1234321 is a palindromic number 阅读全文
posted @ 2018-03-10 17:03 王清河 阅读(210) 评论(0) 推荐(0)