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
{ | |
"configurations": [ | |
{ | |
"name": "WSL", | |
"includePath": ["${workspaceFolder}/**", "/usr/include/**"], | |
"defines": ["_DEBUG", "UNICODE", "_UNICODE"], | |
"compilerPath": "/usr/bin/gcc-9", | |
"cStandard": "c11", | |
"cppStandard": "c++17", | |
"intelliSenseMode": "gcc-x64" |
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
fn main() { | |
for i in 1..=12 { | |
println!("On the {} day of Christmas", to_ordinal(i)); | |
println!("My true love sent to me"); | |
for j in (2..=i).rev() { | |
match j { | |
12 => println!("12 drummers drumming"), | |
11 => println!("Eleven pipers piping"), | |
10 => println!("Ten lords a-leaping"), |
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 main | |
import ( | |
"fmt" | |
"io/ioutil" | |
"log" | |
"os" | |
"path/filepath" | |
"regexp" | |
) |
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
use std::io::stdin; | |
use std::io::{stdout, Write}; | |
struct AddCalculator{} | |
struct SubtractCalculator{} | |
struct MultiplyCalculator{} | |
struct DivideCalculator{} | |
trait Calculator { | |
fn execute(&self, x: i32, y: i32) -> i32; |
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
def compare_and_swap(x, up) | |
mid_point = x.size / 2 | |
(0..(mid_point - 1)).each do |i| | |
if x[i] > x[mid_point + i] == up | |
x[i], x[mid_point + i] = x[mid_point + i], x[i] | |
end | |
end | |
end | |
def sub_sort(x, up) |
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
class TestCase: | |
def __init__(self, name): | |
self.name = name | |
def setUp(self): | |
pass | |
def tearDown(self): | |
pass |
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
require 'prime' | |
def power?(n) | |
if n <= 0 | |
return false | |
end | |
if n == 1 | |
return true | |
end |
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; | |
import java.util.stream.LongStream; | |
public class KaprekarNumber { | |
// カプレカ数(定義1)かどうか | |
private static boolean isKaprekarNumber1(long n){ | |
var s = String.valueOf(n * n); | |
var firstHalf = parseLong(s.substring(0, s.length() / 2)); | |
var latterHalf = parseLong(s.substring(s.length() / 2)); |
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
fn main() { | |
for i in 1..10 { | |
for j in 1..10 { | |
print!("{} * {} = {}\t", i, j, i * j); | |
} | |
println!(); | |
} | |
} |
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
#include <iostream> | |
using namespace std; | |
int main(void){ | |
auto func = [](int a, int b) {return a + b;}; | |
cout << func(3, 4) << endl; | |
return 0; | |
} |
NewerOlder