結果
| 問題 | No.2454 Former < Latter |
| コンテスト | |
| ユーザー |
srjywrdnprkt
|
| 提出日時 | 2023-07-07 17:27:07 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 637 bytes |
| 記録 | |
| コンパイル時間 | 1,884 ms |
| コンパイル使用メモリ | 193,680 KB |
| 最終ジャッジ日時 | 2025-02-15 06:36:24 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 2 TLE * 1 -- * 20 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void solve(){
string S;
int N, ans=0, mi;
cin >> N >> S;
for (int i=1; i<N; i++){
mi = min(i, N-i);
int f=0;
for (int j=0; j<mi; j++){
if (S[j] != S[i+j]){
if (S[j] < S[i+j]) f=1;
else f=-1;
break;
}
}
if (f == 0 && i<N-i){
ans++;
}
if (f == 1){
ans++;
}
}
cout << ans << endl;
}
int main(){
int T;
cin >> T;
while(T){
T--;
solve();
}
return 0;
}
srjywrdnprkt