This file contains hidden or 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::ops::{Add,Sub,Mul,Div,Neg}; | |
use std::fmt; | |
use std::fmt::Display; | |
#[derive(Clone, Copy, Debug)] | |
struct Complex { | |
re: f32, | |
im: f32, | |
} |
This file contains hidden or 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
1 + 0.000i 1 + 1.732i 1 - 1.732i | |
1 + 1.732i -2 + 3.464i 4 - 0.000i | |
1 - 1.732i 4 - 0.000i -2 - 3.464i |
This file contains hidden or 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; | |
use std::io::{Read, BufRead, BufReader}; | |
use std::cmp::{min, max}; | |
use std::collections::HashMap; | |
struct Testcase { | |
sum_price: u64, | |
flavor_prices: Vec<u64>, | |
} |
This file contains hidden or 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 take_mut_ref(ptr: &mut i32) { | |
*ptr += 1; | |
} | |
fn main() { | |
let mut x = 42; | |
{ | |
let ptr = &mut x; | |
take_mut_ref(ptr); |
This file contains hidden or 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 <stdio.h> | |
#include <stdlib.h> | |
#include <limits.h> | |
static int twocomp(unsigned u) | |
{ | |
if (u > INT_MAX) { | |
return (long long)u - (long long)UINT_MAX - 1LL; | |
} else { |
This file contains hidden or 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
1. utasítás: | 2. utasítás: | |
| | |
PC[-2] PC[0] PC[2] | | |
+-------+--------+--------+-------+--------+--------+ | |
| "ADD" | 0x12ab | 0x2468 | "SUB" | 0x2345 | 0x3456 | | |
+-------+--------+--------+-------+--------+--------+ | |
^ ^ ^ ^ | |
+ PC-2 | +- PC+2 +- PC+4 stb. | |
| | |
PC = 0xf00 |
This file contains hidden or 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
.section __TEXT,__text,regular,pure_instructions | |
.macosx_version_min 10, 11 | |
.globl _main | |
.align 4, 0x90 | |
_main: ## @main | |
.cfi_startproc | |
## BB#0: | |
pushq %rbp | |
Ltmp0: | |
.cfi_def_cfa_offset 16 |
This file contains hidden or 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 <stdio.h> | |
#include <spn/ctx.h> | |
typedef struct { | |
SpnContext *ctx; | |
SpnFunction *fn; | |
SpnValue arg; | |
} CallbackData; |
This file contains hidden or 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 <vector> | |
#include <array> | |
#include <cstdio> | |
#include <iostream> | |
#include <random> | |
enum State: unsigned char { | |
Empty, | |
X, |
This file contains hidden or 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
// cloud must be sorted beforehand | |
size_t num_rows = 10; | |
size_t num_cols = 10; | |
size_t min_x = … // find from cloud | |
size_t max_x = … // find from cloud | |
size_t dx = (max_x - min_x) / num_rows; | |
size_t min_y = … // find from cloud |