結果

問題 No.3381 Palindrome Substrings (C++)
コンテスト
ユーザー wanui
提出日時 2025-11-22 13:59:21
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 59 ms / 2,000 ms
コード長 181 bytes
コンパイル時間 1,873 ms
コンパイル使用メモリ 194,880 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-11-22 13:59:26
合計ジャッジ時間 4,038 ms
ジャッジサーバーID
(参考情報)
judge7 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:2:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
    2 | main(){std::string s;int r;std::cin>>r>>s;int a=0;while(r--){int l=r+1;while(l--){int k=0;for(int d=l;d<=r;d++)k+=s[d]!=s[r-d+l];a+=k==0;}}printf("%d\n",a);}
      | ^~~~

ソースコード

diff #
raw source code

#include<bits/stdc++.h>
main(){std::string s;int r;std::cin>>r>>s;int a=0;while(r--){int l=r+1;while(l--){int k=0;for(int d=l;d<=r;d++)k+=s[d]!=s[r-d+l];a+=k==0;}}printf("%d\n",a);}
0