This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://hubspot.kayac.com/js-taiso-001 | |
// c: center | |
// r: relative | |
export default function f(x) { | |
var r = 0.2; // 半径 | |
// xの値によって弧の中心を求める | |
var idx = Math.floor(x /0.2); // 弧のインデックス | |
var cX = idx * 0.2; // 弧の中心のx | |
var cY = r + idx * r; // 弧の中心のy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://go-tour-jp.appspot.com/methods/23 | |
type rot13Reader struct { | |
r io.Reader | |
} | |
func (r13 *rot13Reader) Read(b []byte) (int, error) { | |
n, err := r13.r.Read(b) | |
for i := 0; i < n; i++ { | |
if b[i] > 'A' && b[i] < 'z' { | |
if b[i] > 'z'-13 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func fibonacci() func() int { | |
x, y := 1, 0 | |
return func() int { | |
x, y = y, x+y | |
return x | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Arrays; | |
public class Main { | |
public static void main(String[] args) { | |
int count = 0; | |
for(Secret secret : Secret.values()) { | |
if (secret.name().startsWith("STAR")) { | |
count += 1; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum Currency { | |
USD(""), | |
EUR(""), | |
GBP(""), | |
RUB(""), | |
UAH(""), | |
KZT(""), | |
CAD(""), | |
JPY(""), | |
CNY(""), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
import java.util.stream.Collectors; | |
public class Main { | |
public static void main(String[] args) { | |
Scanner scanner = new Scanner(System.in); | |
int companies = scanner.nextInt(); | |
List<Integer> incomes = scanner.tokens().limit(companies).mapToInt(Integer::parseInt).boxed() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
public class Main { | |
public static void main(String[] args) { | |
Scanner scanner = new Scanner(System.in); | |
int companyNum = scanner.nextInt(); | |
List<Integer> incomes = new ArrayList<>(); | |
List<Integer> taxPer = new ArrayList<>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package machine; | |
import java.security.KeyStore.TrustedCertificateEntry; | |
import java.util.Scanner; | |
public class CoffeeMachine { | |
private static int water = 400; | |
private static int milk = 540; | |
private static int beans = 120; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package machine; | |
import java.util.Scanner; | |
public class CoffeeMachine { | |
private static int water = 400; | |
private static int milk = 540; | |
private static int beans = 120; | |
private static int cups = 9; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package machine; | |
import java.util.Scanner; | |
public class CoffeeMachine { | |
public static void main(String[] args) { | |
Scanner sc = new Scanner(System.in); | |
System.out.println("Write how many ml of water the coffee machine has:"); | |
int water = sc.nextInt(); |
NewerOlder