fn main() {
let mut result = 0;
let mut buffer = 0;
DATA.lines().for_each(|line| {
if line.is_empty() {
if buffer > result {
result = buffer;
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
#![feature(portable_simd)] | |
use rand::random; | |
use std::{array::from_fn, simd::Simd, time::Instant}; | |
#[inline] | |
fn main() { | |
let test: [f32; 64] = from_fn(|_| random()); | |
let random_magic: f32 = random(); | |
let test_2: [f32; 64] = [random_magic; 64]; | |
println!("Data for test: {test:?}"); |
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
#![feature(async_closure)] | |
use futures_util::future::join_all; | |
use std::{iter::zip, time::Duration}; | |
use tokio::time::sleep; | |
#[tokio::main] | |
async fn main() { | |
let ids = [1, 2, 3, 4]; | |
let durations = [200, 100, 300, 250]; |
好笑的是,雖然 using
語法來自 C# ,但用 Rust 的 lifetime 機制來解釋反而更清楚
- 至少一個有開啓 Replica Set 功能的 MongoDB instance
於 Docker 中搭建環境
本機須先安裝
mongosh
def part1(input: String) = {
val index = input
.toCharArray()
.sliding(4)
.zipWithIndex
.map((chars, i) => (chars, i + 4))
.find((chars, _) => chars.distinct.length == 4)
def parseInput(input: String): List[ArrayBuffer[String]] = {
val result = List(
ArrayBuffer[String](),
ArrayBuffer[String](),
ArrayBuffer[String](),
ArrayBuffer[String](),
ArrayBuffer[String](),
@main def main = {
part1(input)
}
def part1(input: String) = {
var count = 0;
input.linesIterator.foreach((line) => {
@main def main = {
part1(input)
}
def part1(input: String) = {
val result = input.linesIterator.map((line) => {
val (first, second) = line.splitAt(line.length() / 2);
enum Choose {
Rock,
Paper,
Scissor,
}
trait CalculateScore {
NewerOlder