Submission #3792430


Source Code Expand

Copy
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define db long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define IT iterator
 
#define PB push_back
#define MK make_pair
#define LB lower_bound
#define UB upper_bound
#define EB emplace_back
#define fi first
#define se second
 
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define UPD(x,y) (((x)+=(y))>=mo?x-=mo:233)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
 
#define LS3 k*2,l,mid
#define RS3 k*2+1,mid+1,r
#define LS5 k*2,l,mid,x,y
#define RS5 k*2+1,mid+1,r,x,y
#define GET pushdown(k);int mid=(l+r)/2
 
#define inf 1e18
#define sqr(x) ((x)*(x))
using namespace std;
char s[300005];
ll ans=0;
int main(){
	scanf("%s",s+1);
	int len=strlen(s+1),cnt=0;
	For(i,1,len)
		if (s[i]=='B') cnt++;
		else ans+=cnt;
	printf("%lld\n",ans);
} 

Submission Info

Submission Time
Task A - Irreversible operation
User zhouyuyang
Language C++14 (GCC 5.4.1)
Score 300
Code Size 987 Byte
Status
Exec Time 3 ms
Memory 384 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:36:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%s",s+1);
                 ^

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample01.txt, sample02.txt
All 300 / 300 sample01.txt, sample02.txt, in01.txt, in02.txt, in03.txt, in04.txt, in05.txt, in06.txt, in07.txt, in08.txt, in09.txt, in10.txt, sample01.txt, sample02.txt
Case Name Status Exec Time Memory
in01.txt 2 ms 384 KB
in02.txt 3 ms 384 KB
in03.txt 2 ms 384 KB
in04.txt 3 ms 384 KB
in05.txt 3 ms 384 KB
in06.txt 3 ms 384 KB
in07.txt 3 ms 384 KB
in08.txt 2 ms 384 KB
in09.txt 2 ms 384 KB
in10.txt 2 ms 384 KB
sample01.txt 1 ms 256 KB
sample02.txt 1 ms 256 KB