Skip to content

Instantly share code, notes, and snippets.

发信人: zhaowei2008 (zhaowei), 信区: JobHunting
标 题: 问个题目: 从1-n 中找出k, 使得 k=a^2 +b^2 (a b 为整数)
发信站: BBS 未名空间站 (Sun Feb 23 15:31:23 2014, 美东)
问个题目: 从1-n 中找出k, 使得 k=a^2 +b^2 (a b 为整数)
有好的算法吗?
(defn find-k [n]
(* Variations of Fizzbuzz in OCaml, translated from the Rust version in
"FizzBuzz Revisited" by Lindsey Kuper:
http://composition.al/blog/2013/03/02/fizzbuzz-revisited/ *)
(* The FizzBuzz test proposed by Imran Ghory:
http://imranontech.com/2007/01/24/using-fizzbuzz-to-find-developers-who-grok-coding/ *)
(* and made famous by Jeff Atwood:
http://www.codinghorror.com/blog/2007/02/why-cant-programmers-program.html *)
define({
initFullFormAjaxUpload: function() {
// Once the FormData instance is ready and we know
// where to send the data, the code is the same
// for both variants of this technique
function sendXHRequest(formData, uri) {
var xhr = new XMLHttpRequest();
@swuecho
swuecho / test.md
Last active August 29, 2015 14:00
definition list
First
Explain
Second
Second Explain
(* test data *)
let answer = Div (Div (Con 1972, Con 2), Con 23);; (* 42 *)
let error = Div(Con 1, Con 0);; (* Exception: Division_by_zero. *)
(* term type *)
type term = Con of int | Div of term * term ;;
(* test data *)
let answer = Div (Div (Con 1972, Con 2), Con 23);; (* 42 *)
let error = Div(Con 1, Con 0);; (* Exception: Division_by_zero. *)
(* term type *)
type term = Con of int | Div of term * term ;;
@swuecho
swuecho / 0_reuse_code.js
Created May 4, 2014 21:04
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
(* term type *)
type term = Con of int | Div of term * term ;;
(* test data *)
let answer = Div (Div (Con 1972, Con 2), Con 23);; (* 42 *)
let error = Div(Con 1, Con 0);; (* Exception: Division_by_zero. *)
use v5.12;
use IO::Scalar;
use Encode qw/decode/;
use LWP::Simple;
use Mojo::DOM;
use Email::Stuffer;
my $data;
## Open a handle on a string, and append to it: