Cod sursa(job #3369159)
| Utilizator | Data | 17 octombrie 2026 14:50:54 | |
|---|---|---|---|
| Problema | Litere | Scor | 0 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.38 kb |
#include <fstream>
using namespace std;
int main()
{
ifstream f("litere.in");
ofstream g("litere.out");
int n, fr[26] = {}, c;
long long int s = 0;
f >> n;
for(int i = 0; i < n; i++)
{
f >> c;
int x = c -'a';
for(int j = x + 1; j < 26; j++)
s += fr[j];
fr[x]++;
}
g << s;
return 0;
}
