結果
| 問題 | No.346 チワワ数え上げ問題 |
| コンテスト | |
| ユーザー |
capythm
|
| 提出日時 | 2016-03-03 00:29:45 |
| 言語 | C++11 (gcc 15.3.0 + boost 1.92.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| + 920µs | |
| コード長 | 343 bytes |
| 記録 | |
| コンパイル時間 | 261 ms |
| コンパイル使用メモリ | 72,008 KB |
| 実行使用メモリ | 9,796 KB |
| 最終ジャッジ日時 | 2026-09-03 06:43:41 |
| 合計ジャッジ時間 | 1,852 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
ソースコード
#include <iostream>
#include <string>
using namespace std;
typedef long long ll;
int main()
{
ios::sync_with_stdio( false );
string s;
cin >> s;
ll n = 0;
ll ret = 0;
for( int i=s.size()-1; i>=0; i-- ){
if( s[i] == 'w' ) {
n++;
} else if( s[i] == 'c' ) {
ret += n * (n-1) / 2;
}
}
cout << ret << endl;
}
capythm