Submission #3587158


Source Code Expand

#include<stdio.h>
int gcd(int x, int y);
int main(void){
  long n,m,i,x,y,g=0;
  scanf("%ld %ld", &n, &m);
  if(n<m){
    i=n;
    n=m;
    m=i;
    g=1;
  }
  char s[n], t[m];
  if(g==1){
   scanf("%s", t);
   scanf("%s",s);
  }
  else {
   scanf("%s", s);
   scanf("%s", t);
  }
  g = gcd(n,m);
  x = n/g;
  y = m/g;
/*
  for(i=0; m >= y*i ; i++){
     
    if(*(s+x*i)==*(t+y*i)); 
    else{
     x=1;
     y=1;
     g=-1;
     break;
     }
   }*/
  printf("%ld",x*y*g);
  return 0;
}
int gcd(int x, int y){
 
  if(x%y==0) return y;
  else {
    int t;
    t = x%y;
    x = y;
    y = t;
    return gcd(x, y);
  }
}

Submission Info

Submission Time
Task A - Two Abbreviations
User Nocks_on
Language C (GCC 5.4.1)
Score 0
Code Size 666 Byte
Status WA
Exec Time 1 ms
Memory 384 KB

Compile Error

./Main.c: In function ‘main’:
./Main.c:5:3: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%ld %ld", &n, &m);
   ^
./Main.c:14:4: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
    scanf("%s", t);
    ^
./Main.c:15:4: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
    scanf("%s",s);
    ^
./Main.c:18:4: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
    scanf("%s", s);
    ^
./Main.c:19:4: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
    scanf("%s", t);
    ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 2
WA × 1
AC × 9
WA × 12
Set Name Test Cases
Sample sample-01.txt, sample-02.txt, sample-03.txt
All sample-01.txt, sample-02.txt, sample-03.txt, sample-01.txt, sample-02.txt, sample-03.txt, subtask01-01.txt, subtask01-02.txt, subtask01-03.txt, subtask01-04.txt, subtask01-05.txt, subtask01-06.txt, subtask01-07.txt, subtask01-08.txt, subtask01-09.txt, subtask01-10.txt, subtask01-11.txt, subtask01-12.txt, subtask01-13.txt, subtask01-14.txt, subtask01-15.txt
Case Name Status Exec Time Memory
sample-01.txt AC 1 ms 128 KB
sample-02.txt WA 1 ms 128 KB
sample-03.txt AC 1 ms 128 KB
subtask01-01.txt WA 1 ms 128 KB
subtask01-02.txt WA 1 ms 256 KB
subtask01-03.txt AC 1 ms 256 KB
subtask01-04.txt AC 1 ms 256 KB
subtask01-05.txt WA 1 ms 256 KB
subtask01-06.txt WA 1 ms 256 KB
subtask01-07.txt WA 1 ms 256 KB
subtask01-08.txt WA 1 ms 256 KB
subtask01-09.txt WA 1 ms 256 KB
subtask01-10.txt AC 1 ms 384 KB
subtask01-11.txt AC 1 ms 256 KB
subtask01-12.txt AC 1 ms 256 KB
subtask01-13.txt WA 1 ms 256 KB
subtask01-14.txt WA 1 ms 256 KB
subtask01-15.txt WA 1 ms 256 KB