Обсуждение участника:VolkovNikita94: различия между версиями

Материал из Алговики
Перейти к навигации Перейти к поиску
(Информация в обсуждении явно устаревшая, а держать 100500 вкладок на одной страничке становится накладно.)
Строка 1: Строка 1:
 +
<tabs>
 +
 +
<tab name="Специальный_пример_1_n4">
 +
{{#widget:Algoviewer
 +
|url=XML_task_001/Example_001.html
 +
|width=1200
 +
|height=800
 +
|border=1
 +
}}
 +
<br>
 +
<div class="collapser mw-collapsible mw-collapsed" style="width:1200px; overflow:auto;">
 +
C++ реализация:
 +
<div class="mw-collapsible-content">
 +
<source lang = "c++">
 +
for (int i = 1; i <= n; ++i) {
 +
C[i] = C[i - 2];
 +
}
 +
for (int i = 1; i <= n; ++i) {
 +
for (int j = 1; j <= n; ++j) {
 +
B[i][j] = B[i][j] + C[i];
 +
}
 +
}
 +
for (int i = 1; i <= n; ++i) {
 +
for (int j = 1; j <= n; ++j) {
 +
for (int k = 1; k <= n; ++k) {
 +
A[i][j][k] = A[i][j][k] + A[i - 1][j][1];
 +
}
 +
}
 +
}
 +
</source>
 +
</div>
 +
</div>
 +
<div class="collapser mw-collapsible mw-collapsed" style="width:1200px; overflow:auto;">
 +
Новая разметка:
 +
<div class="mw-collapsible-content">
 +
<source lang = "xml">
 +
<algo>
 +
  <params>
 +
<param name = "N" type = "int"></param>
 +
  </params>
 +
  <block id = "0" dims = "1">
 +
<arg name = "i" val = "1..N"></arg>
 +
<vertex condition = "" type = "0">
 +
<in src = “i – 2”></in>
 +
</vertex>
 +
  </block>
 +
  <block id = "1" dims = "2">
 +
<arg name = "i" val = "1..N"></arg>
 +
<arg name = "j" val = "1..N"></arg>
 +
<vertex condition = "" type = "0">
 +
                <in bsrc = "0" src = "i"></in>
 +
</vertex>
 +
  </block>
 +
  <block id = "2" dims = "3">
 +
<arg name = "i" val = "1..N"></arg>
 +
<arg name = "j" val = "1..N"></arg>
 +
        <arg name = "k" val = "1..N"></arg>
 +
<vertex condition = "(k == 1) || (i == 1)" type = "0">
 +
</vertex>
 +
<vertex condition = "(k > 1) && (i > 1)" type = "0">
 +
<in src = “1, j, 1”></in>
 +
</vertex>
 +
  </block>
 +
</algo>
 +
</source>
 +
</div>
 +
</div>
 +
</tab>
 +
 +
<tab name="Специальный_пример_1_n8">
 +
{{#widget:Algoviewer
 +
|url=XML_task_001_n8/Example_001.html
 +
|width=1200
 +
|height=800
 +
|border=1
 +
}}
 +
<br>
 +
<div class="collapser mw-collapsible mw-collapsed" style="width:1200px; overflow:auto;">
 +
C++ реализация:
 +
<div class="mw-collapsible-content">
 +
<source lang = "c++">
 +
for (int i = 1; i <= n; ++i) {
 +
C[i] = C[i - 2];
 +
}
 +
for (int i = 1; i <= n; ++i) {
 +
for (int j = 1; j <= n; ++j) {
 +
B[i][j] = B[i][j] + C[i];
 +
}
 +
}
 +
for (int i = 1; i <= n; ++i) {
 +
for (int j = 1; j <= n; ++j) {
 +
for (int k = 1; k <= n; ++k) {
 +
A[i][j][k] = A[i][j][k] + A[i - 1][j][1];
 +
}
 +
}
 +
}
 +
</source>
 +
</div>
 +
</div>
 +
</tab>
 +
 +
<tab name="Специальный_пример_2_n4">
 +
{{#widget:Algoviewer
 +
|url=XML_task_002/Example_001.html
 +
|width=1200
 +
|height=800
 +
|border=1
 +
}}
 +
<br>
 +
<div class="collapser mw-collapsible mw-collapsed" style="width:1200px; overflow:auto;">
 +
C++ реализация:
 +
<div class="mw-collapsible-content">
 +
<source lang = "c++">
 +
for (int i = 1; i <= n; ++i) {
 +
C[i] = C[i] * e;
 +
}
 +
for (int i = 1; i <= n; ++i) {
 +
for (int j = 1; j <= n; ++j) {
 +
B[i][j] = B[i - 1][j - 1];
 +
}
 +
}
 +
for (int i = 1; i <= n; ++i) {
 +
for (int j = 1; j <= n; ++j) {
 +
for (int k = 1; k <= n; ++k) {
 +
A[i][j][k] = A[i][j][k] + A[i][j - 1][k - 2];
 +
}
 +
A[i][j][n] = A[i][j][n] + B[i][j];
 +
}
 +
}
 +
</source>
 +
</div>
 +
</div>
 +
<div class="collapser mw-collapsible mw-collapsed" style="width:1200px; overflow:auto;">
 +
Новая разметка:
 +
<div class="mw-collapsible-content">
 +
<source lang = "xml">
 +
<algo>
 +
<params>
 +
<param name = "N" type = "int"></param>
 +
</params>
 +
<block id = "0" dims = "1">
 +
<arg name = "I" val = "1..N"></arg>
 +
<vertex condition = "" type = "1">
 +
</vertex>
 +
  </block>
 +
<block id = "0" dims = "2">
 +
<arg name = "I" val = "1..N"></arg>
 +
<arg name = "J" val = "1..N"></arg>
 +
<vertex condition = "" type = "1">
 +
<in src = "I - 1, J - 1"></in>
 +
</vertex>
 +
</block>
 +
<block id = "2" dims = "3">
 +
<arg name = "I" val = "1..N"></arg>
 +
<arg name = "J" val = "1..N"></arg>
 +
<arg name = "K" val = "1..N"></arg>
 +
<vertex condition = "K == 1" type = "2">
 +
<in bsrc = "1" src = "I, J"></in>
 +
<in src = "I - 1, J, K + 2"></in>
 +
</vertex>
 +
<vertex condition = "K > 1" type = "1">
 +
<in src = "I - 1, J, K + 2"></in>
 +
</vertex>
 +
</block>
 +
</algo>
 +
</source>
 +
</div>
 +
</div>
 +
</tab>
 +
 +
<tab name="Специальный_пример_2_n8">
 +
{{#widget:Algoviewer
 +
|url=XML_task_002_n8/Example_001.html
 +
|width=1200
 +
|height=800
 +
|border=1
 +
}}
 +
<br>
 +
<div class="collapser mw-collapsible mw-collapsed" style="width:1200px; overflow:auto;">
 +
C++ реализация:
 +
<div class="mw-collapsible-content">
 +
<source lang = "c++">
 +
for (int i = 1; i <= n; ++i) {
 +
C[i] = C[i] * e;
 +
}
 +
for (int i = 1; i <= n; ++i) {
 +
for (int j = 1; j <= n; ++j) {
 +
B[i][j] = B[i - 1][j - 1];
 +
}
 +
}
 +
for (int i = 1; i <= n; ++i) {
 +
for (int j = 1; j <= n; ++j) {
 +
for (int k = 1; k <= n; ++k) {
 +
A[i][j][k] = A[i][j][k] + A[i][j - 1][k - 2];
 +
}
 +
A[i][j][n] = A[i][j][n] + B[i][j];
 +
}
 +
}
 +
</source>
 +
</div>
 +
</tab>
 +
 +
<tab name="Преобразование_фурье">
 +
{{#widget:Algoviewer
 +
|url=XML_Fourier/Example_002.html
 +
|width=1200
 +
|height=800
 +
|border=1
 +
}}
 +
<br>
 +
<div class="collapser mw-collapsible mw-collapsed" style="width:1200px; overflow:auto;">
 +
Новая разметка:
 +
<div class="mw-collapsible-content">
 +
<source lang = "xml">
 +
<algo>
 +
<params>
 +
<param name = "N" type = "int" value = "3"></param>
 +
</params>
 +
<block id = "0" dims = "2">
 +
<arg name = "I" val = "1..N"></arg>
 +
<arg name = "J" val = "1..2^N"></arg>
 +
<vertex condition = "(J - 1) % (2^I) < 2^(I - 1)" type = "1">
 +
<in src = "I - 1, J"></in>
 +
<in src = "I - 1, J + 2^(I -1)"></in>
 +
</vertex>
 +
<vertex condition = "(J - 1) % (2^I) >= 2^(I - 1)" type = "2">
 +
<in src = "I - 1, J"></in>
 +
<in src = "I - 1, J - 2^(I - 1)"></in>
 +
</vertex>
 +
</block>
 +
</algo>
 +
</source>
 +
</div>
 +
</div>
 +
</tab>
 +
 +
</tabs>
 +
 +
== Тестовые варианты 2017 ==
 +
 
<tabs>
 
<tabs>
  

Версия 19:56, 28 июля 2020


C++ реализация:

for (int i = 1; i <= n; ++i) {
	C[i] = C[i - 2];
}
for (int i = 1; i <= n; ++i) {
	for (int j = 1; j <= n; ++j) {
		B[i][j] = B[i][j] + C[i];
	}
}
for (int i = 1; i <= n; ++i) {
	for (int j = 1; j <= n; ++j) {
		for (int k = 1; k <= n; ++k) {
			A[i][j][k] = A[i][j][k] + A[i - 1][j][1];
		}
	}
}

Новая разметка:

<algo>
   <params>
	<param name = "N" type = "int"></param>
   </params>
   <block id = "0" dims = "1">
	<arg name = "i" val = "1..N"></arg>
	<vertex condition = "" type = "0">
		<in src = “i  2”></in>
	</vertex>
   </block>
   <block id = "1" dims = "2">
	<arg name = "i" val = "1..N"></arg>
	<arg name = "j" val = "1..N"></arg>
	<vertex condition = "" type = "0">
                <in bsrc = "0" src = "i"></in>
	</vertex>
   </block>
   <block id = "2" dims = "3">
	<arg name = "i" val = "1..N"></arg>
	<arg name = "j" val = "1..N"></arg>
        <arg name = "k" val = "1..N"></arg>
	<vertex condition = "(k == 1) || (i == 1)" type = "0">
	</vertex>
	<vertex condition = "(k > 1) && (i > 1)" type = "0">
		<in src = “1, j, 1”></in>
	</vertex>
   </block>
</algo>


C++ реализация:

for (int i = 1; i <= n; ++i) {
	C[i] = C[i - 2];
}
for (int i = 1; i <= n; ++i) {
	for (int j = 1; j <= n; ++j) {
		B[i][j] = B[i][j] + C[i];
	}
}
for (int i = 1; i <= n; ++i) {
	for (int j = 1; j <= n; ++j) {
		for (int k = 1; k <= n; ++k) {
			A[i][j][k] = A[i][j][k] + A[i - 1][j][1];
		}
	}
}


C++ реализация:

for (int i = 1; i <= n; ++i) {
	C[i] = C[i] * e;
}
for (int i = 1; i <= n; ++i) {
	for (int j = 1; j <= n; ++j) {
		B[i][j] = B[i - 1][j - 1];
	}
}
for (int i = 1; i <= n; ++i) {
	for (int j = 1; j <= n; ++j) {
		for (int k = 1; k <= n; ++k) {
			A[i][j][k] = A[i][j][k] + A[i][j - 1][k - 2];
		}
		A[i][j][n] = A[i][j][n] + B[i][j];
	}
}

Новая разметка:

<algo>
	<params>
		<param name = "N" type = "int"></param>
	</params>
	<block id = "0" dims = "1">
		<arg name = "I" val = "1..N"></arg>
		<vertex condition = "" type = "1">
		</vertex>
  </block>
	<block id = "0" dims = "2">
		<arg name = "I"	val = "1..N"></arg>
		<arg name = "J" val = "1..N"></arg>
		<vertex condition = "" type = "1">
			<in src = "I - 1, J - 1"></in>
		</vertex>
	</block>
	<block id = "2" dims = "3">
		<arg name = "I" val = "1..N"></arg>
		<arg name = "J" val = "1..N"></arg>
		<arg name = "K" val = "1..N"></arg>
		<vertex condition = "K == 1" type = "2">
			<in bsrc = "1" src = "I, J"></in>
			<in src = "I - 1, J, K + 2"></in>
		</vertex>
		<vertex condition = "K > 1" type = "1">
			<in src = "I - 1, J, K + 2"></in>
		</vertex>
	</block>
</algo>


C++ реализация:

for (int i = 1; i <= n; ++i) {
	C[i] = C[i] * e;
}
for (int i = 1; i <= n; ++i) {
	for (int j = 1; j <= n; ++j) {
		B[i][j] = B[i - 1][j - 1];
	}
}
for (int i = 1; i <= n; ++i) {
	for (int j = 1; j <= n; ++j) {
		for (int k = 1; k <= n; ++k) {
			A[i][j][k] = A[i][j][k] + A[i][j - 1][k - 2];
		}
		A[i][j][n] = A[i][j][n] + B[i][j];
	}
}


Новая разметка:

<algo>
	<params>
		<param name = "N" type = "int" value = "3"></param>
	</params>
	<block id = "0" dims = "2">
		<arg name = "I"	val = "1..N"></arg>
		<arg name = "J" val = "1..2^N"></arg>
		<vertex condition = "(J - 1) % (2^I) < 2^(I - 1)" type = "1">
			<in src = "I - 1, J"></in>
			<in src = "I - 1, J + 2^(I -1)"></in>
		</vertex>
		<vertex condition = "(J - 1) % (2^I) >= 2^(I - 1)" type = "2">
			<in src = "I - 1, J"></in>
			<in src = "I - 1, J - 2^(I - 1)"></in>
		</vertex>
	</block>
</algo>

Тестовые варианты 2017


C++ реализация:

for (int i = 1; i <= n; ++i) {
	C[i] = C[i - 2];
}
for (int i = 1; i <= n; ++i) {
	for (int j = 1; j <= n; ++j) {
		B[i][j] = B[i][j] + C[i];
	}
}
for (int i = 1; i <= n; ++i) {
	for (int j = 1; j <= n; ++j) {
		for (int k = 1; k <= n; ++k) {
			A[i][j][k] = A[i][j][k] + A[i - 1][j][1];
		}
	}
}

Новая разметка:

<algo>
   <params>
	<param name = "N" type = "int"></param>
   </params>
   <block id = "0" dims = "1">
	<arg name = "i" val = "1..N"></arg>
	<vertex condition = "" type = "0">
		<in src = “i  2”></in>
	</vertex>
   </block>
   <block id = "1" dims = "2">
	<arg name = "i" val = "1..N"></arg>
	<arg name = "j" val = "1..N"></arg>
	<vertex condition = "" type = "0">
                <in bsrc = "0" src = "i"></in>
	</vertex>
   </block>
   <block id = "2" dims = "3">
	<arg name = "i" val = "1..N"></arg>
	<arg name = "j" val = "1..N"></arg>
        <arg name = "k" val = "1..N"></arg>
	<vertex condition = "(k == 1) || (i == 1)" type = "0">
	</vertex>
	<vertex condition = "(k > 1) && (i > 1)" type = "0">
		<in src = “1, j, 1”></in>
	</vertex>
   </block>
</algo>


C++ реализация:

for (int i = 1; i <= n; ++i) {
	C[i] = C[i - 2];
}
for (int i = 1; i <= n; ++i) {
	for (int j = 1; j <= n; ++j) {
		B[i][j] = B[i][j] + C[i];
	}
}
for (int i = 1; i <= n; ++i) {
	for (int j = 1; j <= n; ++j) {
		for (int k = 1; k <= n; ++k) {
			A[i][j][k] = A[i][j][k] + A[i - 1][j][1];
		}
	}
}


C++ реализация:

for (int i = 1; i <= n; ++i) {
	C[i] = C[i] * e;
}
for (int i = 1; i <= n; ++i) {
	for (int j = 1; j <= n; ++j) {
		B[i][j] = B[i - 1][j - 1];
	}
}
for (int i = 1; i <= n; ++i) {
	for (int j = 1; j <= n; ++j) {
		for (int k = 1; k <= n; ++k) {
			A[i][j][k] = A[i][j][k] + A[i][j - 1][k - 2];
		}
		A[i][j][n] = A[i][j][n] + B[i][j];
	}
}

Новая разметка:

<algo>
	<params>
		<param name = "N" type = "int"></param>
	</params>
	<block id = "0" dims = "1">
		<arg name = "I" val = "1..N"></arg>
		<vertex condition = "" type = "1">
		</vertex>
  </block>
	<block id = "0" dims = "2">
		<arg name = "I"	val = "1..N"></arg>
		<arg name = "J" val = "1..N"></arg>
		<vertex condition = "" type = "1">
			<in src = "I - 1, J - 1"></in>
		</vertex>
	</block>
	<block id = "2" dims = "3">
		<arg name = "I" val = "1..N"></arg>
		<arg name = "J" val = "1..N"></arg>
		<arg name = "K" val = "1..N"></arg>
		<vertex condition = "K == 1" type = "2">
			<in bsrc = "1" src = "I, J"></in>
			<in src = "I - 1, J, K + 2"></in>
		</vertex>
		<vertex condition = "K > 1" type = "1">
			<in src = "I - 1, J, K + 2"></in>
		</vertex>
	</block>
</algo>


C++ реализация:

for (int i = 1; i <= n; ++i) {
	C[i] = C[i] * e;
}
for (int i = 1; i <= n; ++i) {
	for (int j = 1; j <= n; ++j) {
		B[i][j] = B[i - 1][j - 1];
	}
}
for (int i = 1; i <= n; ++i) {
	for (int j = 1; j <= n; ++j) {
		for (int k = 1; k <= n; ++k) {
			A[i][j][k] = A[i][j][k] + A[i][j - 1][k - 2];
		}
		A[i][j][n] = A[i][j][n] + B[i][j];
	}
}


Новая разметка:

<algo>
	<params>
		<param name = "N" type = "int" value = "3"></param>
	</params>
	<block id = "0" dims = "2">
		<arg name = "I"	val = "1..N"></arg>
		<arg name = "J" val = "1..2^N"></arg>
		<vertex condition = "(J - 1) % (2^I) < 2^(I - 1)" type = "1">
			<in src = "I - 1, J"></in>
			<in src = "I - 1, J + 2^(I -1)"></in>
		</vertex>
		<vertex condition = "(J - 1) % (2^I) >= 2^(I - 1)" type = "2">
			<in src = "I - 1, J"></in>
			<in src = "I - 1, J - 2^(I - 1)"></in>
		</vertex>
	</block>
</algo>