/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 532.0 KiB
#2 Accepted 2ms 540.0 KiB
#3 Accepted 4ms 552.0 KiB
#4 Accepted 4ms 332.0 KiB
#5 Accepted 5ms 492.0 KiB
#6 Accepted 5ms 772.0 KiB
#7 Accepted 5ms 564.0 KiB
#8 Accepted 5ms 332.0 KiB
#9 Accepted 6ms 332.0 KiB
#10 Accepted 6ms 332.0 KiB
#11 Accepted 5ms 332.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-11-11 03:40:57
Judged By
Score
100
Total Time
6ms
Peak Memory
772.0 KiB