結果
問題 | No.346 チワワ数え上げ問題 |
ユーザー |
![]() |
提出日時 | 2016-07-09 03:49:53 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 329 bytes |
コンパイル時間 | 242 ms |
コンパイル使用メモリ | 32,128 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-13 08:04:32 |
合計ジャッジ時間 | 1,369 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 |
ソースコード
#include <cstdio> #include <cstring> using namespace std; char s[111111]; int main(void) { int w = 0; scanf("%s", s); int l = strlen(s); long long res = 0; for (int i = l-1; i >= 0; i--) { if (s[i] == 'w') w += 1; if (s[i] == 'c') { res += w*(w-1ll)/2; } } printf("%lld\n", res); return 0; }