結果
問題 | No.588 空白と回文 |
ユーザー |
![]() |
提出日時 | 2017-11-04 09:52:24 |
言語 | D (dmd 2.109.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 584 bytes |
コンパイル時間 | 613 ms |
コンパイル使用メモリ | 95,828 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-12 22:19:32 |
合計ジャッジ時間 | 1,433 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 12 WA * 13 |
ソースコード
void main(){import std.stdio, std.string, std.conv, std.algorithm;auto s=readln.chomp.to!(char[]);int mx=0;foreach(long j; 1..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));}}