Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Bitnami MediaWiki
Search
Search
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
3646 - Zoom poza
(section)
Page
Discussion
English
Read
Edit
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Restricții și precizări === * Pentru <code>c=1</code>: ** <code>1 ≤ n ≤ m ≤ 70</code> ** <code>1 ≤ a[i][j] ≤ 100.000</code> ** <code>1 ≤ z ≤ 10</code> ** Pentru teste în valoare de 40 de puncte, <code>c=1</code>. * Pentru <code>c=2</code>: ** Pentru 20 de puncte: *** <code>1 ≤ n ≤ m ≤ 70</code> *** <code>1 ≤ a[i][j] ≤ 100.000</code> *** <code>1 ≤ z ≤ 10</code> *** <code>1 ≤ k ≤ 1000</code> *** <code>1 ≤ l1 ≤ c1 ≤ 2500</code> ** Pentru 60 de puncte: *** <code>1 ≤ n ≤ m ≤ 50</code> *** <code>1 ≤ a[i][j] ≤ 9•1018</code> *** <code>1 ≤ z ≤ 9•1014</code> *** <code>1 ≤ k ≤ 1.000</code> *** <code>1 ≤ l1 ≤ c1 ≤ 9•1018</code> * Se recomandă evitarea rezolvării din afișare! <syntaxhighlight lang="python3"> import numpy as np def main(): fin = open("zoom_poza.in", "r") fout = open("zoom_poza.out", "w") numar_c = int(fin.readline()) if numar_c == 1: caz_1(fin, fout) elif numar_c == 2: caz_2(fin, fout) def caz_1(fin, fout): numar_n, numar_m = map(int, fin.readline().split()) # citim numerele n, m numar_z = int(fin.readline()) # citim numar z numar_a = np.zeros((numar_n, numar_m), dtype=int) for i in range(numar_n): line = fin.readline().split() for j in range(numar_m): numar_a[i][j] = int(line[j]) # citim matricea initiala numar_b = np.zeros((numar_n * numar_z, numar_m * numar_z), dtype=int) for i in range(numar_n): constanta = 0 for j in range(numar_m): for numar_x in range(numar_z): for numar_y in range(numar_z): numar_b[i * numar_z + numar_y][ constanta * numar_z + numar_x ] = numar_a[i][j] # se creeaza matricea marita de z ori constanta += 1 for i in range(0, numar_z * numar_n): for j in range(0, numar_z * numar_m): fout.write(str(numar_b[i][j]) + " ") # scriem in fisier matricea rezultata fout.write("\n") def caz_2(fin, fout): numar_n, numar_m = map(int, fin.readline().split()) # citim numerele n, m numar_z = int(fin.readline()) # citim z numar_a = np.zeros((numar_n, numar_m), dtype=int) for i in range(numar_n): line = fin.readline().split() for j in range(numar_m): numar_a[i][j] = int(line[j]) # citim matricea initiala numar_k = int(fin.readline()) # citim numarul k for i in range(numar_k): linia1, coloana1 = map(int, fin.readline().split()) # citim linia 1, coloana 1 line = linia1 / numar_z if linia1 % numar_z != 0: line += 1 column = coloana1 / numar_z if coloana1 % numar_z != 0: column += 1 fout.write( str(numar_a[int(line - 1)][int(column - 1)]) + " " ) # scriem in fisier valoarea de # pe pozitia ceruta if __name__ == "__main__": main() </syntaxhighlight>
Summary:
Please note that all contributions to Bitnami MediaWiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Bitnami MediaWiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Toggle limited content width