結果
| 問題 | No.588 空白と回文 |
| コンテスト | |
| ユーザー |
ikd
|
| 提出日時 | 2017-11-04 10:12:44 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 584 bytes |
| 記録 | |
| コンパイル時間 | 642 ms |
| コンパイル使用メモリ | 94,136 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-12 22:19:35 |
| 合計ジャッジ時間 | 1,429 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 25 |
ソースコード
void main(){
import std.stdio, std.string, std.conv, std.algorithm;
auto s=readln.chomp.to!(char[]);
int mx=0;
foreach(long j; 0..s.length){
auto i=j-1, k=j+1;
int cnt1=1;
while(i>=0 && k<s.length){
if(s[i]==s[k]) cnt1+=2;
i--; k++;
}
i=j; k=j+1;
int cnt2=0;
while(i>=0 && k<s.length){
if(s[i]==s[k]) cnt2+=2;
i--; k++;
}
mx=max(mx, cnt1, cnt2);
}
writeln(mx);
}
void rd(T...)(ref T x){
import std.stdio, std.string, std.conv;
auto l=readln.split;
foreach(i, ref e; x){
e=l[i].to!(typeof(e));
}
}
ikd