/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 316.0 KiB
#2 Accepted 1ms 324.0 KiB
#3 Accepted 9ms 652.0 KiB
#4 Accepted 8ms 320.0 KiB
#5 Accepted 1ms 404.0 KiB
#6 Accepted 109ms 424.0 KiB
#7 Wrong Answer 717ms 424.0 KiB
#8 Time Exceeded ≥1094ms ≥416.0 KiB

Code

#include <stdio.h>

int main(){

    long long int a, b;
    int t;

    scanf("%d", &t);

    int i = 1;

    while(i <= t){
        scanf("%lld %lld", &a, &b);

        int count = 0;

        while(a != 0){
            if (a >= b){
                a = abs(a-b);
                //printf("%d\n", a);
                count++;
            }
            else{
                b = abs(b-a);
                //printf("%d\n", b);
                count++;
                if (b == 0){
                    break;
                }
            }
        }

        printf("%d\n", count);
        i++;
    }

    return 0;
}

Information

Submit By
Type
Submission
Problem
P1029 Make it zero
Contest
Brain booster #2
Language
C99 (GCC 13.2.0)
Submit At
2024-03-06 14:49:31
Judged At
2024-11-11 03:41:47
Judged By
Score
50
Total Time
≥1094ms
Peak Memory
≥652.0 KiB