Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <vector>
- using namespace std;
- int main() {
- std::ifstream fin("input.txt");
- std::ofstream fout("output.txt");
- int n;
- fin >> n;
- vector<int> players;
- int x, max = 0;
- for (int i = 0; i < n; i++) {
- fin >> x;
- players.push_back(x);
- if (players[max] < players[i]) {
- max = i;
- }
- }
- int dad = -1, dad_id = -1;
- for (int i = max + 1; i < players.size() - 1; i++) {
- if (players[i] > players[i + 1] && players[i] > dad && players[i] % 10 == 5) {
- dad_id = i;
- dad = players[i];
- }
- }
- int answ = 0;
- if (dad_id != -1) {
- for (int i = 0; i < players.size(); i++) {
- if (players[i] > players[dad_id]) {
- answ++;
- }
- }
- answ++;
- }
- fout << answ << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment