結果
問題 | No.1551 誕生日の三角形 |
ユーザー | Vwxyz32795915 |
提出日時 | 2021-06-21 19:37:02 |
言語 | Rust (1.77.0 + proconio) |
結果 |
AC
|
実行時間 | 1 ms / 1,000 ms |
コード長 | 3,642 bytes |
コンパイル時間 | 13,515 ms |
コンパイル使用メモリ | 378,196 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-22 22:52:14 |
合計ジャッジ時間 | 11,748 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 0 ms
6,812 KB |
testcase_01 | AC | 1 ms
6,944 KB |
testcase_02 | AC | 1 ms
6,944 KB |
testcase_03 | AC | 0 ms
6,944 KB |
testcase_04 | AC | 1 ms
6,940 KB |
testcase_05 | AC | 1 ms
6,940 KB |
testcase_06 | AC | 1 ms
6,944 KB |
testcase_07 | AC | 1 ms
6,940 KB |
testcase_08 | AC | 1 ms
6,940 KB |
testcase_09 | AC | 1 ms
6,940 KB |
testcase_10 | AC | 1 ms
6,940 KB |
コンパイルメッセージ
warning: unused import: `std::cmp` --> src/main.rs:2:5 | 2 | use std::cmp; | ^^^^^^^^ | = note: `#[warn(unused_imports)]` on by default warning: unused import: `std::cmp::min` --> src/main.rs:3:5 | 3 | use std::cmp::min; | ^^^^^^^^^^^^^ warning: unused import: `std::collections::BTreeMap` --> src/main.rs:4:5 | 4 | use std::collections::BTreeMap; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused import: `std::process` --> src/main.rs:5:5 | 5 | use std::process; | ^^^^^^^^^^^^ warning: unused import: `std::collections::HashMap` --> src/main.rs:7:5 | 7 | use std::collections::HashMap; | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused import: `std::collections::HashSet` --> src/main.rs:8:5 | 8 | use std::collections::HashSet; | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused import: `std::collections::BTreeSet` --> src/main.rs:10:5 | 10 | use std::collections::BTreeSet; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused import: `std::mem` --> src/main.rs:11:5 | 11 | use std::mem; | ^^^^^^^^ warning: unused import: `std::collections::BinaryHeap` --> src/main.rs:12:5 | 12 | use std::collections::BinaryHeap; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused imports: `Hash`, `Hasher` --> src/main.rs:13:17 | 13 | use std::hash::{Hash, Hasher}; | ^^^^ ^^^^^^ warning: variable does not need to be mutable --> src/main.rs:126:9 | 126 | let mut L:f64 = sc.read(); | ----^ | | | help: remove this `mut` | = note: `#[warn(unused_mut)]` on by default warning: variable does not need to be mutable --> src/main.rs:127:9 | 127 | let mut r = 12.0*(3.0 as f64).sqrt(); | ----^ | | | help: remove this `mut` warning: constant `PI` is never used --> src/main.rs:165:7 | 165 | const PI:f64 = std::f64::consts::PI; | ^^ | = note: `#[warn(dead_code)]` on by default warni
ソースコード
use std::cmp::Ordering; use std::cmp; use std::cmp::min; use std::collections::BTreeMap; use std::process; use std::cmp::Ord; use std::collections::HashMap; use std::collections::HashSet; use std::collections::VecDeque; use std::collections::BTreeSet; use std::mem; use std::collections::BinaryHeap; use std::hash::{Hash, Hasher}; pub struct Scanner<R> { stdin: R, } impl<R: std::io::Read> Scanner<R> { pub fn read<T: std::str::FromStr>(&mut self) -> T { use std::io::Read; let buf = self .stdin .by_ref() .bytes() .map(|b| b.unwrap()) .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r') .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r') .collect::<Vec<_>>(); std::str::from_utf8(&buf).unwrap() .parse() .ok() .expect("Parse error.") } pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> { (0..n).map(|_| self.read()).collect() } pub fn chars(&mut self) -> Vec<char> { self.read::<String>().chars().collect() } } pub trait BinarySearch<T> { fn lower_bound(&self, x:&T) -> usize; fn upper_bound(&self, x:&T) -> usize; } impl<T: Ord> BinarySearch<T> for VecDeque<T>{ fn lower_bound(&self, x: &T) -> usize { let mut low = 0; let mut high = self.len(); while low != high { let mid = (low + high) / 2; match self[mid].cmp(x) { Ordering::Less => { low = mid + 1; } Ordering::Equal | Ordering::Greater => { high = mid; } } } low } fn upper_bound(&self, x: &T) -> usize { let mut low = 0; let mut high = self.len(); while low != high { let mid = (low + high) / 2; match self[mid].cmp(x) { Ordering::Less | Ordering::Equal => { low = mid + 1; } Ordering::Greater => { high = mid; } } } low } } impl<T: Ord> BinarySearch<T> for [T]{ fn lower_bound(&self, x: &T) -> usize { let mut low = 0; let mut high = self.len(); while low != high { let mid = (low + high) / 2; match self[mid].cmp(x) { Ordering::Less => { low = mid + 1; } Ordering::Equal | Ordering::Greater => { high = mid; } } } low } fn upper_bound(&self, x: &T) -> usize { let mut low = 0; let mut high = self.len(); while low != high { let mid = (low + high) / 2; match self[mid].cmp(x) { Ordering::Less | Ordering::Equal => { low = mid + 1; } Ordering::Greater => { high = mid; } } } low } } fn solve(){ let sssss = std::io::stdin(); let mut sc = Scanner { stdin: sssss.lock() }; let mut L:f64 = sc.read(); let mut r = 12.0*(3.0 as f64).sqrt(); println!("{}", L*L/r); } fn main(){ solve(); } const PI:f64 = std::f64::consts::PI; pub static MOD:i64 = 1000000007; pub static MODu:usize = 3; pub static MODi32:i32 = 1000000007; pub static eps:f64 = 1e-6; const INF: i64 = 1 << 60; const INFu:usize = 1<<56; const INFu128:u128 = 1<<126;