-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproblem6.cpp
More file actions
39 lines (37 loc) · 828 Bytes
/
Copy pathproblem6.cpp
File metadata and controls
39 lines (37 loc) · 828 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <bits/stdc++.h>
#include<string>
using namespace std;
int counter = 0;
bool compareStrings(string a, string b){
if(a<b)
counter++;
return a<b;
}
int main()
{
int t;
cin>>t;
for(int test=1;test<=t;test++){
int n;
cin>>n;
vector< pair<string,int> > namesNew;
vector<string> names;
string name;
cin.ignore();
for(int i=0;i<n;i++){
getline(cin,name);
namesNew.push_back(make_pair(name,i));
}
counter=0;
for(int i=n-1;i>0;i--){
for(int j=i-1;j>=0;j--){
if(namesNew[i].first < namesNew[j].first){
counter++;
break;
}
}
}
printf("Case #%d: %d\n",test,counter);
}
return 0;
}