CSES - Datatähti 2021 loppu - Results
Submission details
Task:Suuremmat
Sender:xnor
Submission time:2021-01-23 16:12:58 +0200
Language:Rust
Status:READY
Result:100
Feedback
groupverdictscore
#1ACCEPTED35
#2ACCEPTED65
Test results
testverdicttimegroup
#1ACCEPTED0.01 s1, 2details
#2ACCEPTED0.02 s2details

Code

use std::io::{self, BufRead};

fn main() {
    let mut lines = io::BufReader::new(io::stdin()).lines();

    let t = lines.next().unwrap().unwrap().parse::<usize>().unwrap();

    let mut ns = vec![];

    for _ in 0..t {
        ns.push(lines.next().unwrap().unwrap());
    }

    'out: for n in ns {
        for e in 1.. {
            for d in 1..10 {
                if (10u64.pow(e) - 1) / 9 * d > n.parse::<u64>().unwrap() {
                    println!("{}", (10u64.pow(e) - 1) / 9 * d);
                    continue 'out
                }
            }
        }
    }
}

Test details

Test 1

Group: 1, 2

Verdict: ACCEPTED

input
1000
1
2
3
4
...

correct output
2
3
4
5
6
...

user output
2
3
4
5
6
...
Truncated

Test 2

Group: 2

Verdict: ACCEPTED

input
1000
735425311146082632
756615631808964686
466489470801941584
100417544394053220
...

correct output
777777777777777777
777777777777777777
555555555555555555
111111111111111111
555555555555555555
...

user output
777777777777777777
777777777777777777
555555555555555555
111111111111111111
55555555555555
...
Truncated