結果
| 問題 |
No.238 Mr. K's Another Gift
|
| コンテスト | |
| ユーザー |
Tsukasa_Type
|
| 提出日時 | 2018-02-22 17:50:28 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 828 bytes |
| コンパイル時間 | 2,343 ms |
| コンパイル使用メモリ | 79,712 KB |
| 実行使用メモリ | 63,728 KB |
| 最終ジャッジ日時 | 2024-10-01 21:24:37 |
| 合計ジャッジ時間 | 7,509 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | AC * 1 WA * 4 TLE * 1 -- * 34 |
ソースコード
import java.util.*;
public class Main {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
List<Character> s = split(sc.next());
int n = s.size();
boolean F = false;
for (int i=0; i<=n; i++) {
if (i<=n/2) {s.add(i,s.get(n-i-1));}
else {s.add(i,s.get(n-i));}
boolean b = true;
for (int j=0; j<n/2; j++) {
if (s.get(j)!=s.get(n-j-1)) {b = false;}
}
if (b==true) {F=true; break;}
s.remove(i);
}
if (F==false) {System.out.println("NA");}
else {
StringBuilder ans = new StringBuilder();
for (char c : s) {ans.append(c);}
System.out.println(ans.toString());
}
}
static List<Character> split (String s){
List<Character> list = new ArrayList<>();
for (int i=0; i<s.length(); i++) {
list.add(s.charAt(i));
}
return list;
}
}
Tsukasa_Type