2022-07-01ãã1ã¶æéã®è¨äºä¸è¦§
https://atcoder.jp/contests/abc258/tasks/abc258_béãåãæããã«ã¯ãããã¾ãã impl Mul<i32> for Point { type Output = Self; fn mul(self, c: i32) -> Self { Self { x: self.x * c, y: self.y * c } } } ãã¡ã°ã大ããæ°åã®ãã¹ãã辿ã£ã¦ãã¾ããã</i32>â¦
https://atcoder.jp/contests/abc259/tasks/abc259_bsin/cos㯠let x = a * rad.cos() - b * rad.sin(); let y = a * rad.sin() + b * rad.cos(); ãããªãã§ãããã // Counterclockwise Rotation #![allow(non_snake_case)] use std::f64::consts::PI; fnâ¦
https://atcoder.jp/contests/abc260/tasks/abc260_b let mut s = BTreeSet::<usize>::new(); set_from_vec(&s, &ids1, X); ããã ã¨æããã¾ãã 40 | set_from_vec(&s, &ids1, X); | ^^ types differ in mutabilityããã¯ã set_from_vec(&mut s, &ids1, X); ã¨ã</usize>â¦
https://atcoder.jp/contests/abc261/tasks/abc261_bABCã®Båé¡ã解ãã¦ããã¾ããé対è§é¨åã®åº§æ¨ãåæããIteratorãæ¸ãã°ãããã«ãªãã¾ããããªããªã大å¤ã§ãããPythonãªãç°¡åã§ããã // Tournament Result #![allow(non_snake_case)] fn read<T: std::str::FromStr>() </t:>â¦
https://atcoder.jp/contests/abc239/tasks/abc239_aå¹³æ¹æ ¹ãåãã«ã¯ let d = (H * (12800000.0 + H)).sqrt(); ã¨ããã°ããã§ãããf64ã®ã¡ã½ãããªã®ãæ°ã«å ¥ããªãã®ã§é¢æ°ãèªä½ãã¾ãããã fn sqrt(x: f64) -> f64 { fn f(x: f64, y: f64) -> f64 { lâ¦
https://atcoder.jp/contests/abc241/tasks/abc241_ak -> a[k]ã¨ããé¢æ°ã3åé©å¿ããã°ããã®ã§ãfoldã使ãã°ããã§ãããã // Digit Machine #![allow(non_snake_case)] fn read<T: std::str::FromStr>() -> T { let mut line = String::new(); std::io::stdin().read_line(&m</t:>â¦
https://atcoder.jp/contests/abc243/tasks/abc243_aPythonã§ã¯ãã®ããã«cycleã使ãã¨åãããããã§ããã for S, ret in izip(cycle((A, B, C)), cycle('FMT')): ... Rustã§ãåæ§ã®æ¹æ³ã使ãã¾ãã let v = vec![f, m, t]; for p in v.iter().cycle() â¦
https://atcoder.jp/contests/abc245/tasks/abc245_aPersonæ§é ä½ãå®ç¾©ãã¦ãæ¯è¼ãã§ããããã«ãã¾ãã fn main() { let v = read_vec(); let t = Person { H: v[0], M: v[1], S: 0 }; let a = Person { H: v[2], M: v[3], S: 1 }; if t < a { println!("â¦
https://atcoder.jp/contests/abc246/tasks/abc246_aselectã«Vecã§ã¯ãªããã§ããã°iteratorã渡ãããã§ãããã ãªãã¸ã§ã¯ãæåãæããªã㨠fn select(v: Iterator<i32>) -> Option<i32> { ã¿ããã«æ¸ãããã§ãããstd::iter::Iteratorã¯traitãªã®ã§ãGenericsã</i32></i32>â¦
https://atcoder.jp/contests/abc246/tasks/abc246_aå座æ¨ãã«ã¦ã³ããã¦ã1åãããªãæ¹ãæ¬ ãã座æ¨ã§ãã Pythonã§è¾æ¸ãä½ãã¾ãã x_counter = Counter(x for x, y in points) rustã§è¾æ¸ã¯HashMapãBTreeMapã§ãã let v: Vec<i32> = points.iter().map(|p</i32>â¦
https://atcoder.jp/contests/abc247/tasks/abc247_aã¾ããé¨åæååãåã£ã¦ãã¾ãã &S[..S.len()-1]; ããã§æå¾ã®æå以å¤ã®æååãåãããã¨ã«ãªãã¾ããåã¯&strã«ãªãã¾ãã ãã¨ã¯"0"ã¨çµåããã°ããã§ãããæååã®çµåã¯String + &strãªã®ã§â¦
https://atcoder.jp/contests/abc248/tasks/abc248_aç´ ç´ã«setã使ãæ¹æ³ãèãã¾ããããä¾ã«ãã£ã¦Pythonã ã¨ã def F(S): s = set(int(c) for c in S) return next(d for d in range(10) if d not in s) ãããRustã«ããã¨ã let set = S.chars().map(|câ¦
https://atcoder.jp/contests/abc248/tasks/abc248_aç´æçã«ã¯setã使ãã¾ããããsetã®è¦ç´ ãbitã§è¡¨ãã¨Pythonã§ã¯æ¬¡ã®ããã«ãªãã¾ãã def F(S): s = sum(1 << int(c) for c in S) return next(d for d in range(10) if ((1 << d) & s) == 0) ãããRusâ¦
https://atcoder.jp/contests/abc248/tasks/abc248_aã¾ãã¯ãã¡ãã£ã¨ãã¯ãã«ã«ã§å¿ç¨ãå©ããªããå®è£ ã楽ãªæ¹æ³ã使ã£ã¦ã¿ã¾ããPythonãªãããã§ãã def F(S): s = sum(int(c) for c in S) return 45 - s ãããRustã«ããã¨ã let s: i32 = S.chars().â¦
https://atcoder.jp/contests/abc259/tasks/abc259_aå¹´é½¢ãå ¥ããã身é·ãåºãæ§é ä½ã®é¢æ°ãä½ãã¾ãã 0æ³ã®ã¨ãã®èº«é·ãæ§é ä½ã®è¦ç´ ã«ãããã®ã§ãéçé¢æ°ã§ä½ãããã«ãã¾ããéçé¢æ°ãæ¸ãã«ã¯ãselfãå¼æ°ã«æ¸ããªãããã«ããã ãã®ããã§ãã // â¦
https://atcoder.jp/contests/abc250/tasks/abc250_a座æ¨ã®åé¡ãªã®ã§ãPointã¨ããæ§é ä½ãä½ãã¾ãã struct Point { x: i32, y: i32, } è¦ç´ ãã«ã³ãåºåãã§ä¸¦ã¹ãã ãã§ãã ã¡ã½ããã¯æ¬¡ã®ããã«æ¸ãã¾ãã impl Point { fn add(&self, other: &Point)â¦
https://atcoder.jp/contests/abc251/tasks/abc251_aPythonã§ã¯ãããªæãã§ãã def F(S): return S * (6 / len(S)) Rustã§ã¯æãç®ã¿ãããªã®ã¯ãªãããã§ãããã§ã¯åç´ã«è¶³ãç®ã®ãããªæ¸ãæ¹ããã¾ããnã大ãããã°åå²çµ±æ²»æ³ãå¿ è¦ã§ããã fn times(â¦
https://atcoder.jp/contests/abc253/tasks/abc253_aPythonã§ãããªé¢¨ã«æ¸ãã¦ã¿ã¾ããã def median(v): w = sorted(v) if len(w) % 2 == 1: return w[len(w)/2] else: return (w[len(w)/2-1] + w[len(w)/2]) * 0.5 def F(a, b, c): return YesNo(median((aâ¦
https://atcoder.jp/contests/abc254/tasks/abc254_aPythonã§ã¯ã def F(N): return "%02d" % (N % 100) ã§ããããã©ã¼ãããä»ãã¯ã©ããããããã®ã§ããããã println!("{:02}", N % 100) dãä»ãããã¨ããã§ããã10é²ãããã©ã«ããªã®ã§ä»ããªãã¨ãâ¦
https://atcoder.jp/contests/abc255/tasks/abc255_a #![allow(non_snake_case)] ã¨ããã°ãAtCoderã«å¿ è¦ãªå¤§æåã使ã£ã¦ãè¦åãåºãªããªãã¾ãããè¡åã¯Vecã®Vecã§è¡¨ç¾ãã¾ãã let mut M = Vec::<Vec::<i32>>::new(); Vecã®ã¤ã³ããã¯ã¹ãi32ã¨ããã¨ã error[E02</vec::<i32>â¦
https://atcoder.jp/contests/abc256/tasks/abc256_aãããã·ããã使ãã°ç°¡åã§ãããpowé¢æ°ã¯ä½¿ããªãã®ã§ããããã let N: i32 = read(); println!("{}", 2.pow(N)) error[E0689]: can't call method `pow` on ambiguous numeric type `{integer}`2ã ã¨â¦
https://atcoder.jp/contests/abc257/tasks/abc257_aRustã®å¦ç¿ã®ããã«ãABCã®Aåé¡ã解ãã¦ããã¾ããPython2ãªããããªæãã§ãããã def F(N, X): q = (X - 1) / N return chr(q + 65) Rustã§ã¯charé¢æ°ã®ä»£ããã«æ´æ°ãcharã«ãã£ã¹ããã¾ãããã ããâ¦