/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Wrong Answer 0ms 324.0 KiB
#2 Wrong Answer 1ms 284.0 KiB

Code

#include<stdio.h>
int main()
{
  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 13:55:28
Judged At
2024-11-11 03:46:31
Judged By
Score
0
Total Time
1ms
Peak Memory
324.0 KiB