/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Accepted 1ms 364.0 KiB
#3 Accepted 2ms 492.0 KiB
#4 Accepted 2ms 552.0 KiB
#5 Accepted 2ms 352.0 KiB
#6 Accepted 2ms 540.0 KiB
#7 Accepted 3ms 556.0 KiB
#8 Accepted 3ms 564.0 KiB
#9 Accepted 4ms 440.0 KiB
#10 Accepted 3ms 540.0 KiB
#11 Accepted 3ms 552.0 KiB

Code

/*CODED BY mahmudulsakib2019
  DATE:-12/03/2024;TIME:-16:10 pm
  BANGALDESH , SYLHET*/

#include <iostream>
#include <cmath>     ///mathematics
#include<cstdlib>    ///for std::exit(EXIT_SUCCESS)
#include <vector>    ///array
#include <regex>     ///searching_prefix_suffix
#include <algorithm> ///finding_max_min_from_array
#include <string>    ///string_manipulation
#include <numeric>   ///findin total sum of an array
#include<bits/stdc++.h>
using namespace std;

int main() {
    int T;
    std::cin >> T;
    while(T--) {
        long long A, B;
        std::cin >> A >> B;
        long long int count = 0;
        while(A != 0 && B != 0) {
            if(A > B) {
                count += A / B;
                A %= B;
            } else {
                count += B / A;
                B %= A;
            }
        }
        std::cout << count << std::endl;
    }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1029 Make it zero
Language
C++20 (G++ 13.2.0)
Submit At
2024-03-12 10:12:57
Judged At
2024-03-12 10:12:57
Judged By
Score
100
Total Time
4ms
Peak Memory
564.0 KiB