提出 #75851065
ソースコード 拡げる
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define all(x) (x).begin(), (x).end()
#define pb push_back
template<class T> inline bool chmax(T& a, T b) { return a < b ? a = b, 1 : 0; }
template<class T> inline bool chmin(T& a, T b) { return a > b ? a = b, 1 : 0; }
const int MOD = 1e9 + 7;
void solve() {
string s;cin>>s;
int n=s.size();
ll ans=0;
for(int i=0;i<n;i++){
if(s[i]=='C'){
int move=min(i,n-i-1);
ans+=(move+1);
}
}
cout<<ans<<'\n';
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int tt = 1;
//cin >> tt;
while (tt--) {
solve();
}
return 0;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | C - C Stands for Center |
| ユーザ | lavi3 |
| 言語 | C++23 (GCC 15.2.0) |
| 得点 | 300 |
| コード長 | 859 Byte |
| 結果 | AC |
| 実行時間 | 3 ms |
| メモリ | 4072 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 300 / 300 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| 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 | 3384 KiB |
| sample_02.txt | AC | 1 ms | 3600 KiB |
| sample_03.txt | AC | 1 ms | 3456 KiB |
| test_01.txt | AC | 1 ms | 3488 KiB |
| test_02.txt | AC | 1 ms | 3532 KiB |
| test_03.txt | AC | 2 ms | 4008 KiB |
| test_04.txt | AC | 2 ms | 3804 KiB |
| test_05.txt | AC | 3 ms | 4072 KiB |
| test_06.txt | AC | 2 ms | 4064 KiB |
| test_07.txt | AC | 2 ms | 3880 KiB |
| test_08.txt | AC | 3 ms | 3748 KiB |
| test_09.txt | AC | 3 ms | 3944 KiB |
| test_10.txt | AC | 3 ms | 3748 KiB |
| test_11.txt | AC | 3 ms | 3804 KiB |
| test_12.txt | AC | 3 ms | 3964 KiB |