第八届校企合作洽谈会全国250家院校月底来莞
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Results tagged with arithmetic
Search options not deleted
user 2338
百度 在这起事故中,防火墙似乎阻止了一半的火势。
Challenges related to elementary arithmetic.
3
votes
Outputting a base-proof expression
Ceylon/Ceylon, 49.86 40.95 points
The third version uses Ceylon 1.2 for the generator and 509 bytes of code:
import ceylon.language{S=String,I=Integer,e=expand}S q(I n)=>n==0then"0"else(n<0then"-"+p …
1
vote
Strange Addition
Ceylon, 55 / 99
With 0- or space-padded strings of same length (returning an iterable of characters):
function t(String a,String b)=>zipPairs(a,b).map(max);
With 0- or space-padded strings (retu …
2
votes
1, 2, Fizz, 4, Buzz
Ceylon, 368 144 123 96 bytes
shared void z(){for(i in 1..100){print(["FizzBuzz","Buzz","Fizz",i][(i%5).sign*2+(i%3).sign]);}}
Here we have the ungolfed original of 368 bytes:
shared void fizzBuzz( …
1
vote
Let's decrease the monotony
Ceylon, 86 bytes
Object m(Integer+l)=>let(c=l.paired.map(([x,y])=>x<=>y))[if(!smaller in c)equal in c];
The function takes the input as its parameters, and returns a tuple of zero or one booleans – …
0
votes
Simple Factorial Challenge
Ceylon, 98 bytes
import ceylon.whole{l=one}Integer q(Integer n)=>sum({0,*product({l,*(l:n)}).string*.offset('0')});
Try it online
Explanation:
This is quite long, because we need to convince th …
2
votes
Average Two Letters
Ceylon (named function) 74 68 65 64 60
Contrary to e.g. Java, in Ceylon you can't directly add characters (The compiler complains with Left operand must be of summable type: Character is not a subt …