Submission #3024719


Source Code Expand

//23;17

#include<stdio.h>

int len(char S[101]){
  int i = 0;
  while(S[i] != '\0'){
    i++;
  }
  return i;
}

int cmp(char S[101], char T[101]){
  int flag; 
  for(int i=0; i==0||i<len(S); i++){
    if(S[i]!=T[i]){
      flag = 0;
      break;
    }
    else{
      flag = 1;
    }
  }
  return flag;
}

void copy(char S[101], char tmp[101]){
  for(int i=0; i<=len(S); i++){
    tmp[i] = S[i];
  }
}

int main(){
  char S[101], T[101];

  scanf("%s", S);
  scanf("%s", T);

  int flag = 0;
  for(int i=0; i<len(S); i++){
    if(cmp(S,T)==1){
      flag = 1;
      break;
    }
    else{
      flag = 0;
    }

    char tmp[101];
    copy(S, tmp);

    for(int j=0; j<len(S); j++){
      if(j==0){
	S[j] = tmp[len(S)-1];
      }
      else{
	S[j] = tmp[j-1];
      }
    }
  }

  if(flag) printf("Yes\n");
  else printf("No\n");

  return 0;
}

Submission Info

Submission Time
Task B - String Rotation
User htkaaa
Language C++14 (GCC 5.4.1)
Score 200
Code Size 913 Byte
Status AC
Exec Time 2 ms
Memory 128 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:36:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%s", S);
                 ^
./Main.cpp:37:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%s", T);
                 ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 14
Set Name Test Cases
Sample sample_01, sample_02, sample_03
All 0_small_0, 0_small_1, 0_small_2, 0_small_3, 1_medium_0, 1_medium_1, 1_medium_2, 2_max_0, 2_max_1, 2_max_2, 2_max_3, sample_01, sample_02, sample_03
Case Name Status Exec Time Memory
0_small_0 AC 1 ms 128 KB
0_small_1 AC 1 ms 128 KB
0_small_2 AC 1 ms 128 KB
0_small_3 AC 1 ms 128 KB
1_medium_0 AC 1 ms 128 KB
1_medium_1 AC 1 ms 128 KB
1_medium_2 AC 1 ms 128 KB
2_max_0 AC 2 ms 128 KB
2_max_1 AC 2 ms 128 KB
2_max_2 AC 2 ms 128 KB
2_max_3 AC 1 ms 128 KB
sample_01 AC 1 ms 128 KB
sample_02 AC 1 ms 128 KB
sample_03 AC 1 ms 128 KB