2015年8月2日
摘要: Description 给你一个高为n ,宽为m列的网格,计算出这个网格中有多少个矩形,下图为高为2,宽为4的网格. Input 第一行输入一个t, 表示有t组数据,然后每行输入n,m,分别表示网格的高和宽 ( n < 100 , m < 100). Output 每行输出网格中有多少个矩形. Sa 阅读全文
posted @ 2015-08-02 16:31 xx-sisley 阅读(136) 评论(0) 推荐(0) 编辑
摘要: Description Today on a lecture about strings Gerald learned a new definition of string equivalency. Two strings a and b of equal length are calledequi 阅读全文
posted @ 2015-08-02 16:15 xx-sisley 阅读(223) 评论(0) 推荐(0) 编辑
摘要: 题意: 输入正整数n,把整数1,2,3,……,n组成一个环,使得相邻的两个整数之和均为素数。输出时从整数1 开始逆时针排列。同一个环应恰好输出一次。n<=16。 Sample Input Sample Output 分析: 应用DFS和回溯法。 代码: 阅读全文
posted @ 2015-08-02 15:49 xx-sisley 阅读(344) 评论(0) 推荐(0) 编辑
摘要: 题意简概: 输入n个元素组成的序列S,你需要找一个乘积最大的连续子序列。如果这个最大的乘积不是正数,应输出0,表示无解。1<=n<=18,-10<=Si<=10。 Sample Input32 4 -352 5 -1 2 -1Sample OutputCase #1: The maximum pro 阅读全文
posted @ 2015-08-02 15:13 xx-sisley 阅读(156) 评论(0) 推荐(0) 编辑
摘要: Description: Write a program that finds and displays all pairs of 5-digit numbers that between them use the digits 0 through 9 once each, such that th 阅读全文
posted @ 2015-08-02 14:58 xx-sisley 阅读(413) 评论(0) 推荐(0) 编辑
  2015年7月26日
摘要: 题意: 某部队进行新兵队列训练,将新兵从一开始按顺序依次编号,并排成一行横队,训练的规则如下:从头开始一至二报数,凡报到二的出列,剩下的向小序号方向靠拢,再从头开始进行一至三报数,凡报到三的出列,剩下的向小序号方向靠拢,继续从头开始进行一至二报数。。。,以后从头开始轮流进行一至二报数、一至三报数直到 阅读全文
posted @ 2015-07-26 20:06 xx-sisley 阅读(134) 评论(0) 推荐(0) 编辑
  2015年7月24日
摘要: 题目描述: Two bored soldiers are playing card war. Their card deck consists of exactly n cards, numbered from 1 to n, all values are different. They divid 阅读全文
posted @ 2015-07-24 20:40 xx-sisley 阅读(133) 评论(0) 推荐(0) 编辑
摘要: You are given a string consisting of parentheses () and []. A string of this type is said to be correct: Write a program that takes a sequence of stri 阅读全文
posted @ 2015-07-24 20:31 xx-sisley 阅读(156) 评论(0) 推荐(0) 编辑
  2015年7月19日
摘要: 题目大意: 有n(1<=n<=500000)个学生想交换到其他学校学习。为了简单起见,规定每个想从A学校换到B学校的学生必须找一个想到B换到A的搭档。如果每个人都能搭档(一个人不能同时当多个人的搭档),学校就会同意他们交换。每个学生用两个整数A,B表示,你的任务是判断交换是否可行。 sample i 阅读全文
posted @ 2015-07-19 16:49 xx-sisley 阅读(189) 评论(0) 推荐(0) 编辑
  2015年7月17日
摘要: 题目: 有一个coco cola小店,你可以用三个空瓶换一瓶coco cola饮料,如果你有n个空瓶,你可以喝到多少瓶饮料? 输入输出要求: intput:最多有10组案例,每组输入一个整数,0不被处理操作。 Output:每组案例输出你能喝到的饮料数。 sample intput: 3 10 81 阅读全文
posted @ 2015-07-17 15:39 xx-sisley 阅读(122) 评论(0) 推荐(0) 编辑