Skip to content

Commit f8c618e

Browse files
committed
practice 15-Jan-2020
1 parent 0abeb30 commit f8c618e

File tree

3 files changed

+83
-0
lines changed

3 files changed

+83
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#include<bits/stdc++.h>
2+
using namespace std;
3+
4+
int main()
5+
{
6+
ios_base::sync_with_stdio(false);
7+
cin.tie(NULL);
8+
int t;
9+
cin>>t;
10+
while(t--){
11+
string s1,s2;
12+
cin>>s1>>s2;
13+
int maxi=0, mini=0;
14+
int n = s1.length();
15+
for(int i=0;i<n;i++){
16+
if(s1[i]=='?' || s2[i]=='?') {
17+
maxi+=1;
18+
}
19+
else if(s1[i]!=s2[i]){
20+
maxi+=1;
21+
mini+=1;
22+
}
23+
}
24+
cout<<mini<<" "<<maxi<<endl;
25+
}
26+
27+
28+
return 0;
29+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#include<bits/stdc++.h>
2+
using namespace std;
3+
4+
int main()
5+
{
6+
ios_base::sync_with_stdio(false);
7+
cin.tie(NULL);
8+
int n1,n2;
9+
cin>>n1>>n2;
10+
if(n1>n2) cout<<n1-n2;
11+
else cout<<n1+n2;
12+
13+
14+
return 0;
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#include<bits/stdc++.h>
2+
using namespace std;
3+
4+
int main()
5+
{
6+
ios_base::sync_with_stdio(false);
7+
cin.tie(NULL);
8+
int n,k;
9+
cin>>n>>k;
10+
bool arr[n];
11+
memset(arr,false,sizeof(arr));
12+
while(k--){
13+
string s;
14+
getline(cin,s);
15+
getline(cin,s);
16+
int len=s.length();
17+
if(s[7]=='L')
18+
cout<<"0"<<endl;
19+
else{
20+
int res=0;
21+
for(int i=6;i<=len;i++){
22+
int ch=s[i]-'0';
23+
res=(res*10)+ch;
24+
}
25+
if(arr[--res]) {
26+
arr[--res]=false;
27+
}
28+
else {
29+
arr[--res]=true;
30+
}
31+
}
32+
int cnt=0;
33+
for(int i=0;i<n;i++)
34+
if(arr[i]) cnt++;
35+
cout<<cnt<<endl;
36+
}
37+
38+
return 0;
39+
}

0 commit comments

Comments
 (0)