Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions Codeforces/Codeforces_401_777B.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,j;
string s,m;
cin>>n;
cin>>s>>m;
sort(s.begin(),s.end());
sort(m.begin(),m.end());
j=n-1;
for(int i=n-1;i>=0;i--){
if(s[i]<=m[j])j--;
}
cout<<j+1<<"\n";
j=0;
for(int i=0;i<n;i++){
if(m[i]>s[j])j++;
}
cout<<j;
return 0;
}
20 changes: 20 additions & 0 deletions Codeforces/Codeforces_77_96B.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include<bits/stdc++.h>
using namespace std;
long long n;
string s;
int main()
{
cin>>n;
while(1)
{
s+="47";
sort(s.begin(),s.end());
do{
if(stoll(s)>=n)
{
cout<<s<<endl;
return 0;
}
}while(next_permutation(s.begin(),s.end()));
}
}
27 changes: 27 additions & 0 deletions Codeforces/Codeforces_90_1373C.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
for (int j = 0; j < n; ++j)
{
string s;
cin>>s;
long long int res=0,cur=0;
int flag=1;
for(int i=0;i<s.size();i++)
{
if(s[i]=='-')
{
cur-=1;
if(cur<0) {res+=i+1; cur+=1;}
}
else
cur+=1;
}
if(cur>=0) res+=s.size();
cout<<res<<endl;
}
return 0;
}
Binary file added Codeforces/proof_1373C.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Codeforces/proof_777B.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Codeforces/proof_96B.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.