Skip to content

Instantly share code, notes, and snippets.

@Riey
Last active January 28, 2020 01:19
Show Gist options
  • Save Riey/41ebf43b7992b7da0c337adb5a32a4e9 to your computer and use it in GitHub Desktop.
Save Riey/41ebf43b7992b7da0c337adb5a32a4e9 to your computer and use it in GitHub Desktop.
use std::io::{self, BufRead};
use std::iter;
use itertools::Itertools;
fn get_line() -> String {
let mut buf = String::with_capacity(64);
io::stdin().lock().read_line(&mut buf).unwrap();
buf
}
fn read_tuple() -> (i32, i32) {
get_line()
.split(' ')
.map(|s| s.parse().unwrap())
.next_tuple()
.unwrap()
}
fn main() {
let n: usize = get_line().parse().unwrap();
let f: Vec<(i32, i32)> = iter::repeat_with(read_tuple)
.take(n)
.collect();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment