Submission #19580329


Source Code Expand

Copy
#![allow(non_snake_case)]

use std::io::Read;

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

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let x: usize = iterator.next().unwrap().parse().unwrap();
    let y: usize = iterator.next().unwrap().parse().unwrap();

    if x < y {
        return x.to_string();
    }

    if x % y == 0 {
        return "-1".to_string();
    }

    return x.to_string();
}

Submission Info

Submission Time
Task A - Two Integers
User kann0
Language Rust (1.42.0)
Score 100
Code Size 589 Byte
Status AC
Exec Time 9 ms
Memory 2116 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 2
AC × 14
Set Name Test Cases
Sample 0_000.txt, 0_001.txt
All 0_000.txt, 0_001.txt, 1_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
Case Name Status Exec Time Memory
0_000.txt AC 9 ms 1936 KB
0_001.txt AC 7 ms 2044 KB
1_002.txt AC 2 ms 1968 KB
1_003.txt AC 1 ms 2076 KB
1_004.txt AC 1 ms 2000 KB
1_005.txt AC 1 ms 2052 KB
1_006.txt AC 2 ms 2116 KB
1_007.txt AC 2 ms 2004 KB
1_008.txt AC 2 ms 1940 KB
1_009.txt AC 2 ms 2028 KB
1_010.txt AC 2 ms 1964 KB
1_011.txt AC 1 ms 2016 KB
1_012.txt AC 2 ms 2060 KB
1_013.txt AC 2 ms 1968 KB
for_sample.txt AC 2 ms 2004 KB