code stringlengths 1 46.1k ⌀ | label class label 1.18k
classes | domain_label class label 21
classes | index stringlengths 4 5 |
|---|---|---|---|
require 'mathn'
require 'rubygems'
require 'gd2'
include GD2
def hough_transform(img)
mx, my = img.w*0.5, img.h*0.5
max_d = Math.sqrt(mx**2 + my**2)
min_d = max_d * -1
hough = Hash.new(0)
(0..img.w).each do |x|
puts
(0..img.h).each do |y|
if img.pixel2color(img.get_pixel(x,y)).g > 32
(... | 734Hough transform | 14ruby | j8r7x |
next = str(int('123') + 1) | 727Increment a numerical string | 3python | pfqbm |
use strict;
use LWP::UserAgent;
my $url = 'https://www.rosettacode.org';
my $response = LWP::UserAgent->new->get( $url );
$response->is_success or die "Failed to GET '$url': ", $response->status_line;
print $response->as_string; | 733HTTPS | 2perl | l1lc5 |
printf(, TXT); \
scanf(, &VM); \
} while(0);
int main()
{
double lat, slat, lng, ref;
int h;
PICKVALUE(, lat);
PICKVALUE(, lng);
PICKVALUE(, ref);
printf();
slat = sin(DR(lat));
printf(, slat);
printf(, lng - ref);
printf();
for(h = -6; h <= 6; h++)
{
double hla, hra;
... | 739Horizontal sundial calculations | 5c | j8v70 |
null | 735Host introspection | 11kotlin | i20o4 |
ffi = require("ffi")
print("size of int (in bytes): " .. ffi.sizeof(ffi.new("int")))
print("size of pointer (in bytes): " .. ffi.sizeof(ffi.new("int*")))
print((ffi.abi("le") and "little" or "big") .. " endian") | 735Host introspection | 1lua | nv8i8 |
import java.net.*;
class DiscoverHostName {
public static void main(final String[] args) {
try {
System.out.println(InetAddress.getLocalHost().getHostName());
} catch (UnknownHostException e) { | 737Hostname | 9java | f58dv |
var network = new ActiveXObject('WScript.Network');
var hostname = network.computerName;
WScript.echo(hostname); | 737Hostname | 10javascript | yjf6r |
null | 734Hough transform | 15rust | ho7j2 |
import java.awt.image._
import java.io.File
import javax.imageio._
object HoughTransform extends App {
override def main(args: Array[String]) {
val inputData = readDataFromImage(args(0))
val minContrast = if (args.length >= 4) 64 else args(4).toInt
inputData(args(2).toInt, args(3).toInt, mi... | 734Hough transform | 16scala | pdkbj |
s = "12345"
s <- as.character(as.numeric(s) + 1) | 727Increment a numerical string | 13r | joa78 |
echo file_get_contents('https: | 733HTTPS | 12php | qmqx3 |
null | 737Hostname | 11kotlin | 8cw0q |
import urllib.request
print(urllib.request.urlopen().read()) | 733HTTPS | 3python | 2a2lz |
double horner(double *coeffs, int s, double x)
{
int i;
double res = 0.0;
for(i=s-1; i >= 0; i--)
{
res = res * x + coeffs[i];
}
return res;
}
int main()
{
double coeffs[] = { -19.0, 7.0, -4.0, 6.0 };
printf(, horner(coeffs, sizeof(coeffs)/sizeof(double), 3.0));
return 0;
} | 740Horner's rule for polynomial evaluation | 5c | atr11 |
library(RCurl)
webpage <- getURL("https://sourceforge.net/", .opts=list(followlocation=TRUE, ssl.verifyhost=FALSE, ssl.verifypeer=FALSE)) | 733HTTPS | 13r | mkmy4 |
package main
import (
"container/heap"
"fmt"
)
type HuffmanTree interface {
Freq() int
}
type HuffmanLeaf struct {
freq int
value rune
}
type HuffmanNode struct {
freq int
left, right HuffmanTree
}
func (self HuffmanLeaf) Freq() int {
return self.freq
}
func (self HuffmanNo... | 736Huffman coding | 0go | i2sog |
int
main(void)
{
CURL *curl;
char buffer[CURL_ERROR_SIZE];
if ((curl = curl_easy_init()) != NULL) {
curl_easy_setopt(curl, CURLOPT_URL, );
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, buffer);
... | 741HTTP | 5c | i2ao2 |
(defn horner [coeffs x]
(reduce #(-> %1 (* x) (+ %2)) (reverse coeffs)))
(println (horner [-19 7 -4 6] 3)) | 740Horner's rule for polynomial evaluation | 6clojure | smbqr |
import groovy.transform.*
@Canonical
@Sortable(includes = ['freq', 'letter'])
class Node {
String letter
int freq
Node left
Node right
boolean isLeaf() { left == null && right == null }
}
Map correspondance(Node n, Map corresp = [:], String prefix = '') {
if (n.isLeaf()) {
corresp[... | 736Huffman coding | 7groovy | qyaxp |
socket = require "socket"
print( socket.dns.gethostname() ) | 737Hostname | 1lua | olx8h |
'1234'.succ
'99'.succ | 727Increment a numerical string | 14ruby | az01s |
require 'net/https'
require 'uri'
require 'pp'
uri = URI.parse('https:
http = Net::HTTP.new(uri.host,uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
http.start do
content = http.get(uri)
p [content.code, content.message]
pp content.to_hash
puts content.body
end | 733HTTPS | 14ruby | uwuvz |
extern crate reqwest;
fn main() {
let response = match reqwest::blocking::get("https: | 733HTTPS | 15rust | 5x5uq |
static GdkPixbuf*create_pixbuf(const gchar*filename) {
GdkPixbuf*pixbuf;
GError*error = NULL;
pixbuf = gdk_pixbuf_new_from_file(filename, &error);
if(!pixbuf) {
fprintf(stderr,, error->message);
g_error_free(error);
}
return pixbuf;
}
NGON {
double Cx,Cy, r;
int sides, selected;
char c;
};
... | 742Honeycombs | 5c | vat2o |
import Data.List (group, insertBy, sort, sortBy)
import Control.Arrow ((&&&), second)
import Data.Ord (comparing)
data HTree a
= Leaf a
| Branch (HTree a)
(HTree a)
deriving (Show, Eq, Ord)
test :: String -> IO ()
test =
mapM_ (\(a, b) -> putStrLn ('\'': a: ("': " ++ b))) .
serialize . huffmanTre... | 736Huffman coding | 8haskell | va92k |
use Config;
print "UV size: $Config{uvsize}, byte order: $Config{byteorder}\n"; | 735Host introspection | 2perl | rs5gd |
fn next_string(input: &str) -> String {
(input.parse::<i64>().unwrap() + 1).to_string()
}
fn main() {
let s = "-1";
let s2 = next_string(s);
println!("{:?}", s2);
} | 727Increment a numerical string | 15rust | e38aj |
implicit def toSucc(s: String) = new { def succ = BigDecimal(s) + 1 toString } | 727Increment a numerical string | 16scala | qmnxw |
import scala.io.Source
object HttpsTest extends App {
System.setProperty("http.agent", "*")
Source.fromURL("https: | 733HTTPS | 16scala | r0rgn |
use strict;
use warnings;
use feature 'say';
sub identity_matrix {
my($n) = shift() - 1;
map { [ (0) x $_, 1, (0) x ($n - $_) ] } 0..$n
}
for (<4 5 6>) {
say "\n$_:";
say join ' ', @$_ for identity_matrix $_;
} | 730Identity matrix | 2perl | 37mzs |
sub test_num {
my $f = shift;
my $s = shift;
if ($f < $s){
return -1;
} elsif ($f > $s) {
return 1;
} elsif ($f == $s) {
return 0;
};
}; | 725Integer comparison | 2perl | cpr9a |
import Foundation | 733HTTPS | 17swift | vev2r |
int a_list[1<<20 + 1];
int doSqnc( int m)
{
int max_df = 0;
int p2_max = 2;
int v, n;
int k1 = 2;
int lg2 = 1;
double amax = 0;
a_list[0] = -50000;
a_list[1] = a_list[2] = 1;
v = a_list[2];
for (n=3; n <= m; n++) {
v = a_list[n] = a_list[v] + a_list[n-v];
if ( ... | 743Hofstadter-Conway $10,000 sequence | 5c | 9kom1 |
(def a (ref 0))
(def a-history (atom [@a]))
(add-watch a:hist (fn [key ref old new] (swap! a-history conj new))) | 744History variables | 6clojure | vad2f |
typedef int year_t, month_t, week_t, day_t;
typedef struct{
year_t year;
month_t month; day_t month_day; day_t week_day; } date_t;
const char *mon_fmt[] = {0, , , , , , ,
, , , , , };
const char *week_day_fmt[] = {0, , , , , , , };
day_t month_days(year_t year, month_t month)
... | 745Holidays related to Easter | 5c | 4xt5t |
>>> import platform, sys, socket
>>> platform.architecture()
('64bit', 'ELF')
>>> platform.machine()
'x86_64'
>>> platform.node()
'yourhostname'
>>> platform.system()
'Linux'
>>> sys.byteorder
little
>>> socket.gethostname()
'yourhostname'
>>> | 735Host introspection | 3python | 704rm |
(defn get-http [url]
(let [sc (java.util.Scanner.
(.openStream (java.net.URL. url)))]
(while (.hasNext sc)
(println (.nextLine sc)))))
(get-http "http://www.rosettacode.org") | 741HTTP | 6clojure | zgstj |
void h(int n)
{
MPFR_DECL_INIT(a, 200);
MPFR_DECL_INIT(b, 200);
mpfr_fac_ui(a, n, MPFR_RNDD);
mpfr_set_ui(b, 2, MPFR_RNDD);
mpfr_log(b, b, MPFR_RNDD);
mpfr_pow_ui(b, b, n + 1, MPFR_RNDD);
mpfr_div(a, a, b, MPFR_RNDD);
mpfr_div_ui(a, a, 2, MPFR_RNDD);
mpfr_frac(b, a, MPFR_RNDD);
mpfr_printf(, n... | 746Hickerson series of almost integers | 5c | 5wduk |
typedef unsigned long long xint;
typedef struct {
size_t len, alloc;
xint *buf;
} xarray;
xarray rs, ss;
void setsize(xarray *a, size_t size)
{
size_t n = a->alloc;
if (!n) n = 1;
while (n < size) n <<= 1;
if (a->alloc < n) {
a->buf = realloc(a->buf, sizeof(xint) * n);
if (!a->buf) abort();
a->alloc = n... | 747Hofstadter Figure-Figure sequences | 5c | qy5xc |
typedef struct { int x; int y; } point;
void rot(int n, point *p, int rx, int ry) {
int t;
if (!ry) {
if (rx == 1) {
p->x = n - 1 - p->x;
p->y = n - 1 - p->y;
}
t = p->x;
p->x = p->y;
p->y = t;
}
}
void d2pt(int n, int d, point *p) {
int ... | 748Hilbert curve | 5c | 3r1za |
package main
import (
rl "github.com/gen2brain/raylib-go/raylib"
"math"
"strings"
)
type hexagon struct {
x, y float32
letter rune
selected bool
}
func (h hexagon) points(r float32) []rl.Vector2 {
res := make([]rl.Vector2, 7)
for i := 0; i < 7; i++ {
fi := float64(i)
... | 742Honeycombs | 0go | smhqa |
import java.util.*;
abstract class HuffmanTree implements Comparable<HuffmanTree> {
public final int frequency; | 736Huffman coding | 9java | yjt6g |
8 * .Machine$sizeof.long | 735Host introspection | 13r | 5w2uy |
function identity($length) {
return array_map(function($key, $value) {$value[$key] = 1; return $value;}, range(0, $length-1),
array_fill(0, $length, array_fill(0,$length, 0)));
}
function print_identity($identity) {
echo implode(PHP_EOL, array_map(function ($value) {return implode(' ', $value);}, $identity));
}
prin... | 730Identity matrix | 12php | pfeba |
<?php
echo ;
fscanf(STDIN, , $int1);
if(!is_numeric($int1)) {
echo ;
exit(1);
}
echo ;
fscanf(STDIN, , $int2);
if(!is_numeric($int2)) {
echo ;
exit(1);
}
if($int1 < $int2)
echo ;
if($int1 == $int2)
echo ;
if($int1 > $int2)
echo ;
?> | 725Integer comparison | 12php | xydw5 |
import Data.Char (toUpper)
import Data.Function (on)
import Data.List (zipWith4)
import System.Exit
import System.Random
import Graphics.Gloss
import Graphics.Gloss.Data.Vector
import Graphics.Gloss.Geometry
import Graphics.Gloss.Interface.IO.Game
import System.Random.Shuffle
data Hex =
Hex
{ hLetter :: Char ... | 742Honeycombs | 8haskell | 9kimo |
function HuffmanEncoding(str) {
this.str = str;
var count_chars = {};
for (var i = 0; i < str.length; i++)
if (str[i] in count_chars)
count_chars[str[i]] ++;
else
count_chars[str[i]] = 1;
var pq = new BinaryHeap(function(x){return x[0];});
for (var ch in ... | 736Huffman coding | 10javascript | 21mlr |
word_size = 42.size * 8
puts
bytes = [1].pack('S').unpack('C*')
byte_order = (bytes[0] == 0? 'big': 'little') + ' endian'
puts | 735Host introspection | 14ruby | horjx |
(ns rosettacode.hofstader-conway
(:use [clojure.math.numeric-tower:only [expt]]))
(def conway
(memoize
(fn [x]
(if (< x 3)
1
(+ (-> x dec conway conway)
(->> x dec conway (- x) conway))))))
(let [N (drop 1 (range))
pow2 (map #(expt 2 %) N)
groups (p... | 743Hofstadter-Conway $10,000 sequence | 6clojure | uetvi |
(defn hickerson
"Hickerson number, calculated with BigDecimals and manually-entered high-precision value for ln(2)."
[n]
(let [n! (apply *' (range 1M (inc n)))]
(.divide n! (*' 2 (.pow 0.693147180559945309417232121458M (inc n)))
30 BigDecimal/ROUND_HALF_UP)))
(defn almost-integer?
"Tests ... | 746Hickerson series of almost integers | 6clojure | j867m |
#[derive(Copy, Clone, Debug)]
enum Endianness {
Big, Little,
}
impl Endianness {
fn target() -> Self {
#[cfg(target_endian = "big")]
{
Endianness::Big
}
#[cfg(not(target_endian = "big"))]
{
Endianness::Little
}
}
}
fn main() {
pri... | 735Host introspection | 15rust | ki7h5 |
import java.nio.ByteOrder
object ShowByteOrder extends App {
println(ByteOrder.nativeOrder())
println(s"Word size: ${System.getProperty("sun.arch.data.model")}")
println(s"Endianness: ${System.getProperty("sun.cpu.endian")}")
} | 735Host introspection | 16scala | 1fkpf |
use Sys::Hostname;
$name = hostname; | 737Hostname | 2perl | 4xl5d |
import java.util.*
abstract class HuffmanTree(var freq: Int): Comparable<HuffmanTree> {
override fun compareTo(other: HuffmanTree) = freq - other.freq
}
class HuffmanLeaf(freq: Int, var value: Char): HuffmanTree(freq)
class HuffmanNode(var left: HuffmanTree, var right: HuffmanTree): HuffmanTree(left.freq + right... | 736Huffman coding | 11kotlin | f5odo |
echo $_SERVER['HTTP_HOST']; | 737Hostname | 12php | i2qov |
let s = "1234"
if let x = Int(s) {
print("\(x + 1)")
} | 727Increment a numerical string | 17swift | 1tspt |
import 'dart:io';
void main(){
var url = 'http: | 741HTTP | 18dart | x6jwh |
int main()
{
int i, flip, *q = (int*)malloc(sizeof(int) * N) - 1;
q[1] = q[2] = 1;
for (i = 3; i <= N; i++)
q[i] = q[i - q[i - 1]] + q[i - q[i - 2]];
for (i = 1; i <= 10; i++)
printf(, q[i], i == 10 ? '\n' : ' ');
printf(, q[1000]);
for (flip = 0, i = 1; i < N; i++)
flip += q[i] > q[i + 1];
printf(, ... | 749Hofstadter Q sequence | 5c | rsdg7 |
package main
import (
"fmt"
"sort"
"sync"
"time"
) | 744History variables | 0go | atu1f |
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Honeycombs extends JFrame {
public static void main(String[] args) {
SwingUtilities.invokeLater(() -> {
JFrame f = new Honeycombs();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVis... | 742Honeycombs | 9java | t4xf9 |
package main
import (
"fmt"
"math"
"os"
)
func getnum(prompt string) (r float64) {
fmt.Print(prompt)
if _, err := fmt.Scan(&r); err != nil {
fmt.Println(err)
os.Exit(-1)
}
return
}
func main() {
lat := getnum("Enter latitude => ")
lng := getnum("Enter longitu... | 739Horizontal sundial calculations | 0go | f5sd0 |
local build_freqtable = function (data)
local freq = { }
for i = 1, #data do
local cur = string.sub (data, i, i)
local count = freq [cur] or 0
freq [cur] = count + 1
end
local nodes = { }
for w, f in next, freq do
nodes [#nodes + 1] = { word = w, freq = f }
end
table.sort (nodes, functi... | 736Huffman coding | 1lua | t4ifn |
import Data.IORef
newtype HVar a = HVar (IORef [a])
newHVar :: a -> IO (HVar a)
newHVar value = fmap HVar (newIORef [value])
readHVar :: HVar a -> IO a
readHVar (HVar ref) = fmap head (readIORef ref)
writeHVar :: a -> HVar a -> IO ()
writeHVar value (HVar ref) = modifyIORef ref (value:)
undoHVar :: HVar a -> IO ()... | 744History variables | 8haskell | zgwt0 |
null | 742Honeycombs | 11kotlin | olp8z |
a = input('Enter value of a: ')
b = input('Enter value of b: ')
if a < b:
print 'a is less than b'
elif a > b:
print 'a is greater than b'
elif a == b:
print 'a is equal to b' | 725Integer comparison | 3python | l17cv |
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
public class IntegerWithHistory {
private final List<Integer> history;
public IntegerWithHistory(Integer value) {
history = new LinkedList<>();
history.add(value);
}
public void set(Inte... | 744History variables | 9java | olk8d |
roundDec :: Int -> Double -> Double
roundDec d = (/ 10.0 ^ d) . fromIntegral . round . (* 10.0 ^ d)
radToDegr = ((180 / pi) *)
degrToRad = ((pi / 180) *)
main = do
let lat = -4.95
long = -150.5
legalMerid = -150
sinOfLat = sin $ degrToRad lat
diff = legalMerid - long
(putStrLn . unlines)
... | 739Horizontal sundial calculations | 8haskell | 4x95s |
import socket
host = socket.gethostname() | 737Hostname | 3python | gq24h |
Sys.info()[["nodename"]] | 737Hostname | 13r | vam27 |
def identity(size):
matrix = [[0]*size for i in range(size)]
for i in range(size):
matrix[i][i] = 1
for rows in matrix:
for elements in rows:
print elements,
print | 730Identity matrix | 3python | 6j93w |
print("insert number a")
a <- scan(what=numeric(0), nmax=1)
print("insert number b")
b <- scan(what=numeric(0), nmax=1)
if ( a < b ) {
print("a is less than b")
} else if ( a > b ) {
print("a is greater than b")
} else if ( a == b ) {
print("a and b are the same")
} | 725Integer comparison | 13r | yh56h |
(defn qs [q]
(let [n (count q)]
(condp = n
0 [1]
1 [1 1]
(conj q (+ (q (- n (q (- n 1))))
(q (- n (q (- n 2)))))))))
(defn qfirst [n] (-> (iterate qs []) (nth n)))
(println "first 10:" (qfirst 10))
(println "1000th:" (last (qfirst 1000)))
(println "extra credit:" (->> (qfirst ... | 749Hofstadter Q sequence | 6clojure | bn6kz |
package main
import (
"fmt"
"math/big"
)
func main() {
ln2, _ := new(big.Rat).SetString("0.6931471805599453094172")
h := big.NewRat(1, 2)
h.Quo(h, ln2)
var f big.Rat
var w big.Int
for i := int64(1); i <= 17; i++ {
h.Quo(h.Mul(h, f.SetInt64(i)), ln2)
w.Quo(h.Num(), h.Den... | 746Hickerson series of almost integers | 0go | 8c70g |
char response[] =
;
int main()
{
int one = 1, client_fd;
struct sockaddr_in svr_addr, cli_addr;
socklen_t sin_len = sizeof(cli_addr);
int sock = socket(AF_INET, SOCK_STREAM, 0);
if (sock < 0)
err(1, );
setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(int));
int port = 8080;
svr_addr... | 750Hello world/Web server | 5c | 8c504 |
null | 744History variables | 11kotlin | x6gws |
null | 744History variables | 1lua | qyrx0 |
package main
import "fmt"
func horner(x int64, c []int64) (acc int64) {
for i := len(c) - 1; i >= 0; i-- {
acc = acc*x + c[i]
}
return
}
func main() {
fmt.Println(horner(3, []int64{-19, 7, -4, 6}))
} | 740Horner's rule for polynomial evaluation | 0go | mhnyi |
def hornersRule = { coeff, x -> coeff.reverse().inject(0) { accum, c -> (accum * x) + c } } | 740Horner's rule for polynomial evaluation | 7groovy | t4sfh |
package main
import "github.com/fogleman/gg"
var points []gg.Point
const width = 64
func hilbert(x, y, lg, i1, i2 int) {
if lg == 1 {
px := float64(width-x) * 10
py := float64(width-y) * 10
points = append(points, gg.Point{px, py})
return
}
lg >>= 1
hilbert(x+i1*lg, y... | 748Hilbert curve | 0go | bnykh |
require 'socket'
host = Socket.gethostname | 737Hostname | 14ruby | 70uri |
diag(3) | 730Identity matrix | 13r | f43dc |
import Data.Number.CReal
import qualified Data.Number.CReal as C
hickerson :: Int -> C.CReal
hickerson n = (fromIntegral $ product [1..n]) / (2 * (log 2 ^ (n + 1)))
charAfter :: Char -> String -> Char
charAfter ch string = ( dropWhile (/= ch) string ) !! 1
isAlmostInteger :: C.CReal -> Bool
isAlmostInteger = (`ele... | 746Hickerson series of almost integers | 8haskell | lp8ch |
myDoc = '''
Single-quoted heredocs allows no '#{foo}' interpolation.
This behavior is similar to single-quoted strings.
'''
doc2 = """
However, double-quoted heredocs *do* allow these.
See it in action:
Content: "#{myDoc}"
"""
console.log doc2 | 751Here document | 6clojure | nvgik |
horner :: (Num a) => a -> [a] -> a
horner x = foldr (\a b -> a + b*x) 0
main = print $ horner 3 [-19, 7, -4, 6] | 740Horner's rule for polynomial evaluation | 8haskell | kiuh0 |
import Data.Bool (bool)
import Data.Tree
rule :: Char -> String
rule c =
case c of
'a' -> "daab"
'b' -> "cbba"
'c' -> "bccd"
'd' -> "addc"
_ -> []
vectors :: Char -> [(Int, Int)]
vectors c =
case c of
'a' -> [(-1, 1), (-1, -1), (1, -1), (1, 1)]
'b' -> [(1, -1), (-1, -1), (-1, 1), (1, 1... | 748Hilbert curve | 8haskell | duhn4 |
use warnings;
use strict;
use Tk;
use List::Util qw(shuffle);
sub altitude {
sqrt(3/4) * shift;
}
sub polygon_coordinates {
my ($x, $y, $size) = @_;
my $alt = altitude($size);
return ($x - $size, $y,
$x - ($size / 2), $y - $alt,
$x + ($size / 2), $y - $alt,
... | 742Honeycombs | 2perl | gqy4e |
fn main() {
match hostname::get_hostname() {
Some(host) => println!("hostname: {}", host),
None => eprintln!("Could not get hostname!"),
}
} | 737Hostname | 15rust | j8572 |
println(java.net.InetAddress.getLocalHost.getHostName) | 737Hostname | 16scala | bnrk6 |
import java.math.*;
public class Hickerson {
final static String LN2 = "0.693147180559945309417232121458";
public static void main(String[] args) {
for (int n = 1; n <= 17; n++)
System.out.printf("%2s is almost integer:%s%n", n, almostInteger(n));
}
static boolean almostInteger(i... | 746Hickerson series of almost integers | 9java | 3rezg |
typedef struct{
int a,b,c;
int perimeter;
double area;
}triangle;
typedef struct elem{
triangle t;
struct elem* next;
}cell;
typedef cell* list;
void addAndOrderList(list *a,triangle t){
list iter,temp;
int flag = 0;
if(*a==NULL){
*a = (list)malloc(sizeof(cell));
(*a)->t = t;
(*a)->next = NULL;
}
e... | 752Heronian triangles | 5c | olu80 |
(ns goodbye-world.handler
(:require [compojure.core:refer:all]
[compojure.handler:as handler]
[compojure.route:as route]))
(defroutes app-routes
(GET "/" [] "Goodbye, World!")
(route/resources "/")
(route/not-found "Not Found"))
(def app
(handler/site app-routes)) | 750Hello world/Web server | 6clojure | f5jdm |
package main
import "fmt"
var ffr, ffs func(int) int | 747Hofstadter Figure-Figure sequences | 0go | 218l7 |
import java.util.Scanner;
public class Sundial {
public static void main(String[] args) {
double lat, slat, lng, ref;
Scanner sc = new Scanner(System.in);
System.out.print("Enter latitude: ");
lat = sc.nextDouble();
System.out.print("Enter longitude: ");
lng = sc.ne... | 739Horizontal sundial calculations | 9java | cbt9h |
int main()
{
fprintf(stderr, );
fputs(, stderr);
return 0;
} | 753Hello world/Standard error | 5c | 1fzpj |
import Data.List (delete, sort)
ffr :: Int -> Int
ffr n = rl !! (n - 1)
where
rl = 1: fig 1 [2 ..]
fig n (x:xs) = n_: fig n_ (delete n_ xs)
where
n_ = n + x
ffs :: Int -> Int
ffs n = rl !! n
where
rl = 2: figDiff 1 [2 ..]
figDiff n (x:xs) = x: figDiff n_ (delete n_ xs)
where
... | 747Hofstadter Figure-Figure sequences | 8haskell | atl1g |
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class Horner {
public static void main(String[] args){
List<Double> coeffs = new ArrayList<Double>();
coeffs.add(-19.0);
coeffs.add(7.0);
coeffs.add(-4.0);
coeffs.add(6.0);
System... | 740Horner's rule for polynomial evaluation | 9java | 4xm58 |
null | 748Hilbert curve | 9java | sm5q0 |
import java.lang.Math.atan2
import java.lang.Math.cos
import java.lang.Math.sin
import java.lang.Math.toDegrees
import java.lang.Math.toRadians | 739Horizontal sundial calculations | 11kotlin | 3roz5 |
SELECT host_name FROM v$instance; | 737Hostname | 19sql | ath1t |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.