<?xml version='1.0' encoding="utf-8"?>
      <rss version='2.0'>
      <channel>
      <title>Форум на Исходниках.RU</title>
      <link>https://forum.sources.ru</link>
      <description>Форум на Исходниках.RU</description>
      <generator>Форум на Исходниках.RU</generator>
  	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=413774&amp;view=findpost&amp;p=3782717</guid>
        <pubDate>Wed, 14 Nov 2018 15:09:26 +0000</pubDate>
        <title>Сортировка вставками в целочисленной матрице с использование функции</title>
        <link>https://forum.sources.ru/index.php?showtopic=413774&amp;view=findpost&amp;p=3782717</link>
        <description><![CDATA[Славян: Схема, например, такая:<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">// ConsoleApplication1.cpp: определяет точку входа для консольного приложения.</div><div class="code_line">// TABSIZE=4</div><div class="code_line">&nbsp;</div><div class="code_line">#include &quot;stdafx.h&quot;</div><div class="code_line">#include &#60;stdlib.h&#62;</div><div class="code_line">&nbsp;</div><div class="code_line">#define M &nbsp; 5</div><div class="code_line">#define N &nbsp; 8</div><div class="code_line">&nbsp;</div><div class="code_line">int A[M][N]={{ 2, &nbsp;0, &nbsp;3, 6,-2, 9, 1, 1}, &nbsp; //4</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; { 1, &nbsp;2, &nbsp;2, 2, 5,19,11,16}, &nbsp; //4</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; { 4, 10, &nbsp;3,16,-2, 9,-5, 8}, &nbsp; //5</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; { 3, 20, 31,61,-2, 9,-1,11}, &nbsp; //2</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {34,412,-32,62,-2, 3,21,12}}; &nbsp;//6</div><div class="code_line">&nbsp;</div><div class="code_line">int f( const int *a)</div><div class="code_line">{</div><div class="code_line">&nbsp;&nbsp; &nbsp;int чётных=0;</div><div class="code_line">&nbsp;&nbsp; &nbsp;for( int i=0; i&#60;N; i++)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if( !(a[i]&amp;1) ) чётных++;</div><div class="code_line">&nbsp;&nbsp; &nbsp;return чётных;</div><div class="code_line">}</div><div class="code_line">&nbsp;</div><div class="code_line">int sort_f( const void *a, const void *b) { return f((int*)a) - f((int*)b); }</div><div class="code_line">&nbsp;</div><div class="code_line">int main()</div><div class="code_line">{</div><div class="code_line">&nbsp;&nbsp; &nbsp;qsort( &amp;A[0][0], M, sizeof(int)*N, sort_f); // быстрая. Заменить на сортировку вставками</div><div class="code_line">&nbsp;&nbsp; &nbsp;return 0;</div><div class="code_line">}</div></ol></div></div></div></div><script>preloadCodeButtons('1');</script>]]></description>
        <author>Славян</author>
        <category>C/C++: Прочее</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=413774&amp;view=findpost&amp;p=3782714</guid>
        <pubDate>Wed, 14 Nov 2018 14:39:04 +0000</pubDate>
        <title>Сортировка вставками в целочисленной матрице с использование функции</title>
        <link>https://forum.sources.ru/index.php?showtopic=413774&amp;view=findpost&amp;p=3782714</link>
        <description><![CDATA[forgotten: Здравствуйте,нужна помощь в написании кода.Заранее спасибо :) <br><br>Вот само задание:<br><br>Дана целочисленная матрица размером MxN. Пусть для каждой строки<br>матрицы определена функция f(a), равная количеству четных чисел среди<br>элементов строки a. Упорядочить (переставить) строки матрицы по<br>невозрастанию в соответствии со следующим критерием: строка a считается<br>&quot;больше&quot; строки b, если f(a) &gt; f(b). Используйте алгоритм сортировки<br>вставками.]]></description>
        <author>forgotten</author>
        <category>C/C++: Прочее</category>
      </item>
	
      </channel>
      </rss>
	