Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main(){
- int n, n13=0, nn=0, nw13=0, nwn=0, ans=0;
- int w[4];
- cin>>n;
- for(int i=0;i<4;i++){
- cin>>w[i];
- if(w[i]%13==0){
- n13+=1;
- nw13+=1;
- }
- else{
- nn++;
- nwn++;
- }
- }
- for(int e=0;e<n-4;e++){
- int a; cin>>a;
- if(a%13==0){
- ans+=(n13+nn-nw13-nwn);
- n13++;
- nw13++;
- }
- else{
- ans+=(n13-nw13);
- nn++;
- nwn++;
- }
- if(w[0]%13==0)
- {
- nw13--;
- }
- else
- {
- nwn--;
- }
- for(int i=1; i<4; i++)
- {
- w[i-1]=w[i];
- }
- w[3]=a;
- }
- cout<<ans<<endl;
- // 0 <- 1 <- 2 <- 3
- // !a
- // 12 312 4 {23 [{34 12 13} 12}] 34 4 3 2
- // n_13, n_n, n_w13, n_wn, w1, w2, w3, w4
- //vector<int> mass(n);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement