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
network: | |
ethernets: | |
ens18: | |
addresses: | |
- 148.251.222.76/29 | |
- 2a01:4f8:241:1004:1::107/80 | |
routes: | |
- to: 0.0.0.0/0 | |
via: 10.9.0.1 | |
on-link: true |
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
module main | |
let rand = new System.Random() | |
let swap (a: _[]) x y = | |
let tmp = a.[x] | |
a.[x] <- a.[y] | |
a.[y] <- tmp | |
let shuffle a = |
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
#[macro_use] extern crate nom; | |
named!(parser<Vec<Vec<&[u8]>>>, | |
separated_list!( | |
tag!("def"), | |
many0!(tag!("abc")) | |
) | |
); | |
fn main() { |
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
error[E0282]: type annotations needed | |
--> src/main.rs:3:1 | |
| | |
3 | named!(parser<Vec<Vec<&[u8]>>>, | |
| _^ | |
| |_| | |
| || | |
4 | || separated_list!( | |
5 | || tag!("def"), | |
6 | || many0!(tag!("abc")) |
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
Compiling nbug v0.1.0 (file:///mnt/c/Users/mloc/Desktop/devel/byxml/nbug) | |
error[E0277]: the trait bound `&[u8]: nom::Compare<u8>` is not satisfied | |
--> src/main.rs:3:1 | |
| | |
3 | / named!(ident, | |
4 | | recognize!(tuple!( | |
5 | | tag!(b'_'), | |
6 | | tag!(b'_') | |
7 | | )) | |
8 | | ); |
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
error[E0277]: the trait bound `&[u8]: nom::Compare<char>` is not satisfied | |
--> src/main.rs:3:1 | |
| | |
3 | / named!(ident, | |
4 | | recognize!(tuple!( | |
5 | | tag!('_'), | |
6 | | tag!('_') | |
7 | | )) | |
8 | | ); | |
| |__^ the trait `nom::Compare<char>` is not implemented for `&[u8]` |
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
#[macro_use] extern crate nom; | |
named!(ident, | |
recognize!(tuple!( | |
tag!('_'), | |
tag!('_') | |
)) | |
); | |
fn main() { |
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 heapsort(l): | |
heapify(l) | |
for j in range(len(l) - 1, 0, -1): | |
l[0], l[j] = l[j], l[0] | |
i = 0 | |
last = j - 1 | |
while last >= i * 2 + 1: | |
r = i * 2 + 1 | |
cur_down = i |
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::fs::File; | |
use std::io::Read; | |
fn main() { | |
let mut f = File::open("d5.in").expect("input file not found"); | |
let mut s = String::new(); | |
f.read_to_string(&mut s).unwrap(); | |
let mut v: Vec<isize> = s.split("\n") |
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
s = open("d1.in", "r").read().strip() | |
count = 0 | |
d = len(s) // 2 | |
for i, c in enumerate(s): | |
if c == s[i - d]: | |
count += int(s[i - d]) | |
print(count) |
NewerOlder