提出 #75839010


ソースコード 拡げる

#include <bits/stdc++.h>
#define int long long
#define ll long long
#define ull unsigned long long
#define inf 1e12
#define eps 1e-9
#define il inline
#define ls 2*k
#define rs 2*k+1
using namespace std;
const int N=2e5+5,M=250005;
const int mod=998244353;
inline int read(){
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){
        if(ch=='-') f=-1;
        ch=getchar();
    }
    while(ch>='0' && ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*f;
}
int n;
string s;
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int tc=1; 
	while(tc--){
		cin>>s;
		n=s.size();
		s=" "+s;
		int ans=0;
		for(int i=1;i<=n;i++){
			if(s[i]!='C') continue;
			ans=ans+min(i,n-i+1);
		}
		cout<<ans<<'\n';
	}
	return 0;
}
/*

*/

提出情報

提出日時
問題 C - C Stands for Center
ユーザ Limingxuan
言語 C++23 (GCC 15.2.0)
得点 300
コード長 798 Byte
結果 AC
実行時間 2 ms
メモリ 4324 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 3
AC × 15
セット名 テストケース
Sample sample_01.txt, sample_02.txt, sample_03.txt
All sample_01.txt, sample_02.txt, sample_03.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt
ケース名 結果 実行時間 メモリ
sample_01.txt AC 1 ms 3404 KiB
sample_02.txt AC 1 ms 3420 KiB
sample_03.txt AC 1 ms 3432 KiB
test_01.txt AC 1 ms 3404 KiB
test_02.txt AC 1 ms 3432 KiB
test_03.txt AC 2 ms 4300 KiB
test_04.txt AC 2 ms 4304 KiB
test_05.txt AC 2 ms 4324 KiB
test_06.txt AC 2 ms 4300 KiB
test_07.txt AC 2 ms 4312 KiB
test_08.txt AC 2 ms 4252 KiB
test_09.txt AC 2 ms 4232 KiB
test_10.txt AC 2 ms 4260 KiB
test_11.txt AC 2 ms 4264 KiB
test_12.txt AC 2 ms 4252 KiB