Submission #16477949


Source Code Expand

Copy
use proconio::input;

fn main() {
    input! {
        mut a: i64,
        mut b: i64,
        mut c: i64,
    };
    let mut count = 0_i64;
    let mut p_a = None;
    let mut p_b = None;
    let mut p_c = None;
    while a % 2 == 0 && b % 2 == 0 && c % 2 == 0 {
        if p_a == Some(a) && p_b == Some(b) && p_c == (Some(c)) {
            println!("-1");
            return;
        }
        p_a = Some(a);
        p_b = Some(b);
        p_c = Some(c);
        count += 1;

        let h_a = a / 2;
        let h_b = b / 2;
        let h_c = c / 2;
        a = h_b + h_c;
        b = h_a + h_c;
        c = h_a + h_b;
    }
    let ans = count;
    println!("{}", ans);
}

Submission Info

Submission Time
Task A - Cookie Exchanges
User bouzuya
Language Rust (1.42.0)
Score 300
Code Size 676 Byte
Status AC
Exec Time 6 ms
Memory 2120 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 17
Set Name Test Cases
Sample sample1.txt, sample2.txt, sample3.txt
All sample1.txt, sample2.txt, sample3.txt, in1.txt, in10.txt, in11.txt, in2.txt, in3.txt, in4.txt, in5.txt, in6.txt, in7.txt, in8.txt, in9.txt, sample1.txt, sample2.txt, sample3.txt
Case Name Status Exec Time Memory
in1.txt AC 6 ms 2108 KB
in10.txt AC 1 ms 2108 KB
in11.txt AC 2 ms 2052 KB
in2.txt AC 1 ms 2016 KB
in3.txt AC 2 ms 2040 KB
in4.txt AC 1 ms 1980 KB
in5.txt AC 1 ms 2056 KB
in6.txt AC 2 ms 2120 KB
in7.txt AC 2 ms 2120 KB
in8.txt AC 1 ms 2004 KB
in9.txt AC 2 ms 2068 KB
sample1.txt AC 2 ms 2120 KB
sample2.txt AC 2 ms 2040 KB
sample3.txt AC 2 ms 2000 KB