/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Wrong Answer 0ms 516.0 KiB
#2 Time Exceeded ≥3090ms ≥324.0 KiB

Code

#include<stdio.h>
int main()
{
  int T;
  scanf("%d", &T);

  for(int j = 1; j<=T; j++)
  {
     int  n, m, div = 0;
     scanf("%d %d", &n, &m);

     if(n>m)
     {
        for(int i = n; i>1; i--)
        {
          if(n%i == 0 && m%i == 0)
           {
             div = i;
           }
        }
        if(div == 0)
        {
         printf("-1");
        }

        else
        {
         printf("%d", div);
        }

    }

    else if(m > n)
    {
     for(int i = m; i>1; i--)
     {
         if(n%i == 0 && m%i == 0)
         {
             div = i;
         }
     }

     if(div == 0)
     {
        printf("-1");
     }
     else
     {
         printf("%d", div);
     }


     }
  }

}

Information

Submit By
Type
Submission
Problem
P1011 LCD
Contest
Brain booster - 1
Language
C99 (GCC 13.2.0)
Submit At
2023-12-31 14:04:22
Judged At
2024-11-11 03:46:26
Judged By
Score
0
Total Time
≥3090ms
Peak Memory
≥516.0 KiB