結果
問題 | No.2234 palindromer |
ユーザー |
![]() |
提出日時 | 2023-03-03 21:47:25 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 571 bytes |
コンパイル時間 | 253 ms |
コンパイル使用メモリ | 29,568 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-17 22:41:25 |
合計ジャッジ時間 | 643 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 |
ソースコード
#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; }