File tree Expand file tree Collapse file tree
competitive programming/codechef Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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 number Diff line number Diff line change 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 number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments