This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//sous-tache 2
#include <iostream>
#include <vector>
using namespace std;
int main ()
{
int nbCandidats, objectif, entree, total = 0, candidatDansIntervalle = 0, candidatsDansIntervalle = 0;
vector<int> candidats;
cin >> nbCandidats;
for (int i = 0; i < nbCandidats; i++)
{
cin >> entree;
candidats.push_back(entree);
}
cin >> objectif;
for (int i = 0; i < nbCandidats; i++)
{
if (candidats[i] == objectif)
{
candidatDansIntervalle = 1;
candidatsDansIntervalle ++;
}
else if (candidats[i] < objectif)
{
candidatsDansIntervalle ++;
}
else
{
total += candidatsDansIntervalle * candidatDansIntervalle;
candidatsDansIntervalle = 0;
candidatDansIntervalle = 0;
}
}
total += candidatsDansIntervalle * candidatDansIntervalle;
candidatsDansIntervalle = 0;
candidatDansIntervalle = 0;
cout << total;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |