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
1708 - Cuburi 3
(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!
= Exemplu: = <code>cuburi.in</code> 31 2 18250 9280 18250 953805 20800 6040065 24208 4405 8794 1720 98886 96400 45544 8560056 36055 60400 80200 11560 36475 26992 68320 69400 20296 72640 34048 57700 66520 47440 91232 26080 90280 <code>cuburi.out</code> 2 10 2 10 305 20 4005 20 4 4 1 86 40 44 5005 30 40 20 10 34 22 20 40 20 20 30 50 20 40 12 20 == Încărcare soluție == === Lipește codul aici === <syntaxhighlight lang="python" line="1"> import math def nrmin(x, nrc): v = [int(digit) for digit in str(x)] Min = v[0] imin = 0 for i in range(4): if v[i] < Min and v[i] != 0: Min = v[i] imin = i nr = Min in_index = imin + 1 sf = 4 while sf < nrc: Min = v[in_index] imin = in_index for i in range(in_index, sf + 1): if v[i] < Min: Min = v[i] imin = i nr = nr * 10 + Min in_index = imin + 1 sf += 1 return nr def main(): with open("cuburi.in", "r") as stdin, open("cuburi.out", "w") as stdout: n, k = map(int, stdin.readline().split()) nr = sum(i * i * 6 for i in range(1, k + 1)) w = [] nrpir = 0 s = 0 for i in range(1, n + 1): x = int(stdin.readline()) nrc = int(math.log10(x)) + 1 if i % 6 == 0 and math.sqrt(i // 6) == int(math.sqrt(i // 6)): s += i if s <= n: nrpir += 1 if i <= nr: w.append(nrmin(x, nrc)) stdout.write(f"{nrpir}\n") for num in w: stdout.write(f"{num} ") stdout.write("\n") 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