最近学了ruby,快乐编程果真名不虚传。尝试写了个生成随机数的脚本,算是练手。
一、功能需求
输入随机数区间[a,b), 和数据规模c,输出c个位于区间内的随机整数,每个输出一行。
二、编写代码
#! /usr/bin/ruby
# Example:
# genrand 3 8 4
# will generate 4 Integer range from 3 to 8
#This...
分类:
其他好文 时间:
2014-12-03 21:25:13
阅读次数:
171
又是一个八皇后问题:
Given an integer n, return all distinct solutions to the n-queens puzzle.
Each solution contains a distinct board configuration of the n-queens' placement, where 'Q' and '.' both
...
分类:
其他好文 时间:
2014-12-03 21:17:08
阅读次数:
175
http://poj.org/problem?id=2109题意:kn= p,已知n,p,求k。1=1 and an integer p>= 1 you have to write a program that determines the n th positive root of p. In t...
分类:
其他好文 时间:
2014-12-03 21:08:49
阅读次数:
141
Evaluate the value of an arithmetic expression inReverse Polish Notation.Valid operators are+,-,*,/. Each operand may be an integer or another express...
分类:
其他好文 时间:
2014-12-03 12:14:39
阅读次数:
169
#include #include #pragma comment(lib,"ws2_32.lib")void print_ip(int ip){ unsigned char bytes[4]; bytes[0] = ip & 0xFF; bytes[1] = (ip >> 8) & 0xFF; b...
分类:
其他好文 时间:
2014-12-03 11:52:27
阅读次数:
207
packagecom.example.threadcomm;importandroid.R.integer;importandroid.app.Activity;importandroid.os.Bundle;importandroid.os.Handler;importandroid.os.Looper;importandroid.os.Message;importandroid.util.Log;importandroid.view.View;importandroid.view.View.OnClick..
分类:
移动开发 时间:
2014-12-03 10:40:34
阅读次数:
160
以QUICKREPORT为例页面设置如下:其中ID为编号。设置为表的ID字段。QUICKREPORT所在的FORM添加一个变量:var FprnT6: TFprnT6; Vxh:integer; //编号变量公开一个方法,用以设置变量的初始值: public { Public declar...
分类:
数据库 时间:
2014-12-03 08:09:26
阅读次数:
189
Time Limit: 10000/4000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 820 Accepted Submission(s):
202
Problem Description
Given a positive integer n, yo...
分类:
其他好文 时间:
2014-12-03 00:30:09
阅读次数:
280
题目:Implementatoito convert a string to an integer.---- 实现atoi函数,此函数的功能是将一个字符串转换成一个整数。Hint:Carefully consider all possible input cases. If you want a c...
分类:
其他好文 时间:
2014-12-02 22:16:11
阅读次数:
224
Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.分析:首先我们熟悉下Roman数字组成规则:罗马数字一共有7个符号,'I':1, 'V'...
分类:
其他好文 时间:
2014-12-02 22:13:38
阅读次数:
161