/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 320.0 KiB
#2 Wrong Answer 1ms 532.0 KiB
#3 Wrong Answer 1ms 444.0 KiB

Code

#include <iostream>
#include <iomanip>

int main() {
    int G;
    std::cin >> G;

    for (int i = 0; i < G; ++i) {
        int A, U; 
        std::cin >> A >> U;

        if (A == 0) {
            std::cout << "Game #" << i + 1 << ": 0 / 1" << std::endl;
            continue;
        }

        U = std::min(U, A); 

        int gcd = 1;
        for (int j = 1; j <= U; ++j) {
            if (A % j == 0 && U % j == 0) {
                gcd = j;
            }
        }

        int numerator = U / gcd;
        int denominator = A / gcd;

        std::cout << "Game #" << i + 1 << ": " << numerator << " / " << denominator << std::endl;
    }

    return 0;
}

Information

Submit By
Type
Submission
Problem
P1001 Achievement-Unlocked
Language
C++20 (G++ 13.2.0)
Submit At
2024-03-06 13:19:40
Judged At
2024-11-11 03:42:41
Judged By
Score
0
Total Time
1ms
Peak Memory
532.0 KiB