이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//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... |