結果

問題 No.2234 palindromer
ユーザー 👑 chro_96chro_96
提出日時 2023-03-03 21:47:25
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 571 bytes
コンパイル時間 1,044 ms
コンパイル使用メモリ 29,340 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-18 01:44:09
合計ジャッジ時間 1,361 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 1 ms
4,348 KB
testcase_11 AC 1 ms
4,348 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 AC 1 ms
4,348 KB
testcase_14 AC 1 ms
4,348 KB
testcase_15 AC 1 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

int main () {
  char a[101] = "";
  
  int res = 0;
  
  char ans[200] = "";
  
  int len = 0;
  int is_ok = 0;
  
  res = scanf("%s", a);
  while (a[len] != '\0') {
    ans[len] = a[len];
    len++;
  }
  
  for (int i = 0; i < len; i++) {
    if (is_ok <= 0) {
      for (int j = 0; j < i; j++) {
        ans[len+i-j-1] = ans[j];
      }
      ans[len+i] = '\0';
      is_ok = 1;
      for (int j = 0; j < len+i; j++) {
        if (ans[j] != ans[len+i-j-1]) {
          is_ok = 0;
        }
      }
    }
  }
  
  printf("%s\n", ans);
  return 0;
}
0