-
Notifications
You must be signed in to change notification settings - Fork 0
/
181103dir.cpp
45 lines (45 loc) · 996 Bytes
/
181103dir.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include<bits/stdc++.h>
using namespace std;
int main(){
//freopen("dir.in","r",stdin);
//freopen("dir.out","w",stdout);
char c,d;
d='0';
int sum=0;
int l=0;
int g[100000];
memset(g,0,sizeof(g));
int last=0;
bool flg=0;
while(cin>>c){
cout<<c<<'\n';
if(c==')')break;
cout<<"FUC";
if((c!='F')&&(d=='L'||d=='R')){
g[last++]=((d=='L')?1:-1);
flg=1;
}
if((flg==1)&&(c=='F')){
g[last++]=((d=='L')?1:-1);
sum++;
g[last]=0;
for(int i=last-1;i>=0;i++){
g[i]=g[i]+g[i+1];
if((last-i)%4==0&&g[i]%4==0)sum--;
}
//memset(g,0,sizeof(g));
last=0;
flg=0;
}
if(c=='F')sum+=2;
else sum+=1;
d=c;
cout<<sum<<"SUM\n";
}
if(c=='F')sum--;
cout<<sum;
cin>>sum;
//fclose(stdin);
//fclose(stdout);
return 0;
}