/
Ikocs
/
cpp-tasks
Обзор
Документация
Войти
/
Ikocs
/
cpp-tasks
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
6_move_zeroes/main.cpp
16 строк
408 B
Alexey Elfimov
Init commit
16 сен 2024, 14:45
16 сен 2024, 14:45
08b7ab0
Код
Авторство
О чём код?
#include <iostream> #include <vector> #include <algorithm> std::vector<int> move_zeroes(const std::vector<int>& input) { auto new_v = input; std::stable_partition(new_v.begin(), new_v.end(), [](int n) { return n > 0; } ); return new_v; } int main() { auto v = move_zeroes(std::vector<int>{1, 2, 0, 1, 0, 1, 0, 3, 0, 1}); std::cout << "Hello, World!" << v.size() << std::endl; return 0; }