Beginner Free Contest 55 - FIBOXOR

View as PDF

Submit solution

Points: 0.20 (partial)
Time limit: 1.0s
Memory limit: 512M

Problem type
Allowed languages
C, C++, Go, Java, Kotlin, Pascal, PyPy, Python, Rust, Scratch

In case the statement didn't load correctly, you can download the statement here: Statement

Lưu ý: các bạn không nhập, xuất dữ liệu bằng file kể cả khi đề bài có yêu cầu. Đọc, ghi dữ liệu được thực hiện ở stdin và stdout.


Comments

Please read the guidelines before commenting.



  • 2
    ngoccaidu2008  commented on Oct. 18, 2025, 2:50 p.m.

    Ta phép xor là: ^ (cho dễ viết) như vậy:

    f0=a

    f1=b

    f2=f0^f1=a^b

    f3=f2^f1=(a^b)^b=a^(b^b)=a^0=a

    f4=f3^f2=a^(a^b)=(a^a)^b=b

    f5=f4^f3=b^a

    f6=f5^f4=(b^a)^b=a^(b^b)=a

    f7=f6^f5=a^(b^a)=b

    như vậy ta thấy các số a và b và a^b nó lặp theo 1 chu kì nhất định

    f0,f3,f6,f9.....=a

    f1,f4,f7,f10....=b

    f2,f5,f8,f11....=a^b

    Như vậy chỉ cần kiểm tra khi chia dư với 3 xem nó ở cái nào