結果
| 問題 |
No.346 チワワ数え上げ問題
|
| コンテスト | |
| ユーザー |
hogeover30
|
| 提出日時 | 2016-02-27 01:41:06 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 2,000 ms |
| コード長 | 319 bytes |
| コンパイル時間 | 720 ms |
| コンパイル使用メモリ | 55,728 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-24 10:57:27 |
| 合計ジャッジ時間 | 1,618 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
ソースコード
#include <iostream>
#include <string>
long a[100010];
using namespace std;
int main()
{
string s;
cin>>s;
int n=s.size();
for(int i=0; i<n; ++i) a[n-i-1]=a[n-i]+(s[n-i-1]=='w');
long res=0;
for(int i=0; i<n; ++i)
if (s[i]=='c')
res+=a[i]*(a[i]-1)/2;
cout<<res<<endl;
}
hogeover30