Cod sursa(job #3322644)
| Utilizator | Data | 15 noiembrie 2025 10:12:47 | |
|---|---|---|---|
| Problema | Litere | Scor | 40 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.34 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream in("litere.in");
ofstream out("litere.out");
int main() {
int n;
char s[10001];
in >> n >> s;
long long cnt = 0;
for(int i = 0; i < n; i++) {
for(int j = i+1; j < n; j++) {
if(s[i] > s[j]) cnt++;
}
}
out << cnt;
}