結果
問題 | No.346 チワワ数え上げ問題 |
ユーザー |
![]() |
提出日時 | 2016-02-26 22:36:59 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 950 bytes |
コンパイル時間 | 1,771 ms |
コンパイル使用メモリ | 158,508 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-22 22:00:00 |
合計ジャッジ時間 | 2,553 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 |
ソースコード
#include <bits/stdc++.h>using namespace std;#undef _P#define _P(...) (void)printf(__VA_ARGS__)#define FORR(x,arr) for(auto&& x:arr)#define FOR(i,a,b) for (int i = (a); i < (b); i++)#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); i--)#define REP(i,n) for (int i = 0; i < (n); i++)#define RREP(i,n) for (int i = (n)-1; i >= 0; i--)#define ALL(x) (x).begin(), (x).end()#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)#define BIT(n) (1LL<<(n))#define SZ(x) ((int)(x).size())typedef long long ll;// -------------------------------------string S;int main() {cin >> S;ll cw1 = 0;ll cw2 = 0;ll ans = 0;int L = SZ(S);REP(i, L) {char c = S[i];//printf("%d: %c\n", i, c);if (c == 'c') {cw1++;}else if (c == 'w') {ans+=cw2;cw2+=cw1;}}cout << ans << endl;return 0;}