結果

問題 No.1700 floor X
ユーザー Masaki Kitaguchi
提出日時 2022-01-08 03:22:58
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 14 ms / 2,000 ms
コード長 529 bytes
コンパイル時間 11,723 ms
コンパイル使用メモリ 379,964 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-03 10:52:36
合計ジャッジ時間 13,905 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 44
権限があれば一括ダウンロードができます

ソースコード

diff #

fn main() {
    let mut buf = String::new();
    let mut input = {
        use std::io::Read;
        std::io::stdin().read_to_string(&mut buf).unwrap();
        buf.split_whitespace()
    };

    let t: usize = input.next().unwrap().parse().unwrap();
    let n: Vec<u64> = (0..t)
        .map(|_| input.next().unwrap().parse().unwrap())
        .collect();

    for i in 0..t {
        let x = (n[i] as f64).sqrt().floor() as u64;
        let ans = if x.pow(2) <= n[i] { x } else { x - 1 };
        println!("{}", ans);
    }
}
0