Submission #1232823
Source Code Expand
use std::io; use std::io::{Read, BufReader}; use std::cmp; fn next_token<R: Read>(reader: &mut R) -> Vec<u8> { let mut buf: [u8; 1] = [0]; let mut read_chars = false; let mut ret: Vec<u8> = vec![]; loop { if reader.read(&mut buf).unwrap() == 0 { break; } else { if buf[0] == '\r' as u8 || buf[0] == '\n' as u8 || buf[0] == ' ' as u8 { if read_chars { break; } } else { read_chars = true; ret.push(buf[0]); } } }; ret } fn next_i64<R: Read>(reader: &mut R) -> i64 { let token = next_token(reader); let mut ret: i64 = 0; let mut sgn = false; for c in token { if '0' as u8 <= c && c <= '9' as u8 { ret = ret * 10 + (c - ('0' as u8)) as i64; } else if '-' as u8 == c { sgn = true; } }; ret * if sgn { -1 } else { 1 } } fn next_i32<R: Read>(reader: &mut R) -> i32 { next_i64(reader) as i32 } fn main() { let buf = &mut BufReader::new(io::stdin()); let x = next_i32(buf); let mut i = 1; let mut s = 0; loop { s += i; if s >= x { println!("{}", i); break; } i += 1; } }
Submission Info
Submission Time | |
---|---|
Task | C - Go Home |
User | semiexp |
Language | Rust (1.15.1) |
Score | 200 |
Code Size | 1362 Byte |
Status | AC |
Exec Time | 2 ms |
Memory | 4352 KB |
Compile Error
warning: unused import: `std::cmp`, #[warn(unused_imports)] on by default --> ./Main.rs:3:5 | 3 | use std::cmp; | ^^^^^^^^
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 0_000.txt, 0_001.txt, 0_002.txt |
All | 0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt, 1_015.txt, 1_016.txt, 1_017.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_000.txt | AC | 2 ms | 4352 KB |
0_001.txt | AC | 2 ms | 4352 KB |
0_002.txt | AC | 2 ms | 4352 KB |
1_003.txt | AC | 2 ms | 4352 KB |
1_004.txt | AC | 2 ms | 4352 KB |
1_005.txt | AC | 2 ms | 4352 KB |
1_006.txt | AC | 2 ms | 4352 KB |
1_007.txt | AC | 2 ms | 4352 KB |
1_008.txt | AC | 2 ms | 4352 KB |
1_009.txt | AC | 2 ms | 4352 KB |
1_010.txt | AC | 2 ms | 4352 KB |
1_011.txt | AC | 2 ms | 4352 KB |
1_012.txt | AC | 2 ms | 4352 KB |
1_013.txt | AC | 2 ms | 4352 KB |
1_014.txt | AC | 2 ms | 4352 KB |
1_015.txt | AC | 2 ms | 4352 KB |
1_016.txt | AC | 2 ms | 4352 KB |
1_017.txt | AC | 2 ms | 4352 KB |