結果
問題 | No.2234 palindromer |
ユーザー |
![]() |
提出日時 | 2023-05-05 16:27:27 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 687 bytes |
コンパイル時間 | 340 ms |
コンパイル使用メモリ | 42,752 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-23 01:15:57 |
合計ジャッジ時間 | 1,049 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 |
ソースコード
/* -*- coding: utf-8 -*-** 2234.cc: No.2234 palindromer - yukicoder*/#include<cstdio>#include<cstring>#include<algorithm>using namespace std;/* constant */const int MAX_N = 100;/* typedef *//* global variables */char s[MAX_N + 4];/* subroutines */inline bool palindrome(int n, char t[]) {for (int i = 0, j = n - 1; i < j; i++, j--)if (t[i] != t[j]) return false;return true;}/* main */int main() {scanf("%s", s);int n = strlen(s);int k = 0;for (; k < n; k++)if (palindrome(n - k, s + k)) break;for (int i = 0; i < n; i++) putchar(s[i]);for (int i = k - 1; i >= 0; i--) putchar(s[i]);putchar('\n');return 0;}