結果
問題 | No.588 空白と回文 |
ユーザー |
![]() |
提出日時 | 2017-11-04 09:53:19 |
言語 | D (dmd 2.109.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 584 bytes |
コンパイル時間 | 715 ms |
コンパイル使用メモリ | 93,960 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-12 22:19:34 |
合計ジャッジ時間 | 1,512 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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; 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)); } }