Czesc
Rozwiazuje sobie zadanie z OIG
a konkretnie takie jedno
https://szkopul.edu.pl/problemset/problem/ERz8Uez5UFnNbPH2Jn965eZ/site/?key=statement
Znalazłem sobie w necie takie rozwiazanie
#include <iostream>
#include <vector>
#include <algorithm>
std::vector<std::string> Wektor;
using namespace std;
bool Sortowanie(std::string A, std::string B )
{
if( A.length() > B.length() ) return true;
else if( A.length() == B.length() )
{
if( A < B ) return false;
else return true;
}
else return false;
}
int main()
{
std::ios_base::sync_with_stdio(false);
std::string Tekst;
int T;
std::cin >> T;
while(T--)
{
std::cin >> Tekst;
Wektor.push_back(Tekst);
}
cout<<endl;
std::sort( Wektor.begin(), Wektor.end(), Sortowanie );
for( int i = Wektor.size()-1; i >= 0; i-- ) std::cout << Wektor[i] << "\n";
return 0;
}
tylko nie za bardzo rozumiem dzialanie tej funkcji sort z STL-a ,a dokladnie co robi ta funkcja "Sortowanie"