摘要: 给定一个非负整数a(不超过106),是否存在整数b,使得a和b的乘积全为1。如果存在,返回最小的乘积的位数。如果不存在,返回-1。样例:a=3,存在b=37,使得3*37=111,则函数应返回3(111的位数)。using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication15{ class Program { static void Main(string[] args) { ... 阅读全文
posted @ 2014-02-10 14:37 Ligeance 阅读(209) 评论(0) 推荐(0) 编辑
摘要: 如果字符串str3能够由str1和str2中的字符按顺序交替形成,那么称str3为str1和str2的交替字符串。例如str1="abc",str2="def",那么"adbecf", "abcdef", "abdecf", "abcdef", "adefbc"等等都为str1和str2的交替字符串。更形式化的,str3的生成算法如下:str3=""while str1不为空 or str2不为空: 把str1或str2的首字符加入到s 阅读全文
posted @ 2014-02-10 13:58 Ligeance 阅读(605) 评论(0) 推荐(0) 编辑