ŠØŠ°Ń…Š¼Š°Ń‚Ń‹! Heeelp!Did you play chess? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

ŠØŠ°Ń…Š¼Š°Ń‚Ń‹! Heeelp!Did you play chess?

The grain problem on a chessboard is a mathematical problem that calculates how many grains there will be on a chessboard if you put twice as many grains on each subsequent square of the chessboard as on the previous one, starting with one. To solve this problem, consider that the Board has 64 cells. When doubling the number of grains on each subsequent cell, the sum of grains on all 64 cells is determined by the expression {\displaystyle T_{64}=1+2+4+\cdots +2^{63}=\sum _{i=0}^{63}2^{i}=2^{64}-1,} which is 18 446 744 073 709 551 615 PLEASE,WRITE THIS PROGRAMM IN PYTHON! Š—Š°Š“Š°Ń‡Š° Š¾ Š·Ń‘Ń€Š½Š°Ń… Š½Š° шŠ°Ń…Š¼Š°Ń‚Š½Š¾Š¹ Š“Š¾ŃŠŗŠµ ā€” Š¼Š°Ń‚ŠµŠ¼Š°Ń‚ŠøчŠµŃŠŗŠ°Ń Š·Š°Š“Š°Ń‡Š°, Š² ŠŗŠ¾Ń‚Š¾Ń€Š¾Š¹ Š²Ń‹Ń‡ŠøсŠ»ŃŠµŃ‚ся, сŠŗŠ¾Š»ŃŒŠŗŠ¾ Š±ŃƒŠ“ŠµŃ‚ Š·Ń‘Ń€ŠµŠ½ Š½Š° шŠ°Ń…Š¼Š°Ń‚Š½Š¾Š¹ Š“Š¾ŃŠŗŠµ, ŠµŃŠ»Šø ŠŗŠ»Š°ŃŃ‚ŃŒ Š½Š° ŠŗŠ°Š¶Š“ую сŠ»ŠµŠ“ующую ŠŗŠ»ŠµŃ‚Šŗу Š“Š¾ŃŠŗŠø Š²Š“Š²Š¾Šµ Š±Š¾Š»ŃŒŃˆŠµ Š·Ń‘Ń€ŠµŠ½, чŠµŠ¼ Š½Š° ŠæрŠµŠ“ыŠ“ущую, Š½Š°Ń‡ŠøŠ½Š°Ń с Š¾Š“Š½Š¾Š³Š¾. Š”Š»Ń ŠµŃ‘ рŠµŃˆŠµŠ½Šøя учтёŠ¼, чтŠ¾ Š“Š¾ŃŠŗŠ° ŠøŠ¼ŠµŠµŃ‚ 64 ŠŗŠ»ŠµŃ‚ŠŗŠø. ŠŸŃ€Šø уŠ“Š²Š¾ŠµŠ½ŠøŠø ŠŗŠ¾Š»ŠøчŠµŃŃ‚Š²Š° Š·Ń‘Ń€ŠµŠ½ Š½Š° ŠŗŠ°Š¶Š“Š¾Š¹ ŠæŠ¾ŃŠ»ŠµŠ“ующŠµŠ¹ ŠŗŠ»ŠµŃ‚ŠŗŠµ суŠ¼Š¼Š° Š·Ń‘Ń€ŠµŠ½ Š½Š° Š²ŃŠµŃ… 64 ŠŗŠ»ŠµŃ‚ŠŗŠ°Ń… Š¾ŠæрŠµŠ“ŠµŠ»ŃŠµŃ‚ся Š²Ń‹Ń€Š°Š¶ŠµŠ½ŠøŠµŠ¼ {\displaystyle T_{64}=1+2+4+\cdots +2^{63}=\sum _{i=0

9th Nov 2018, 3:51 PM
Sara H
Sara H - avatar
10 Respostas
+ 6
Where is your attempt???
9th Nov 2018, 3:57 PM
KrOW
KrOW - avatar
+ 8
Nice! It wasn't that hard, was it? You can even do it in one line: print(sum(2**i for i in range(64))) We usually don't write full codes for others because people often ask for quick solutions for their homework. Users are encouraged to learn the language and try to solve the problems themselves. When they get stuck, we're more than happy to help out! Hope you understand :)
9th Nov 2018, 4:56 PM
Kishalaya Saha
Kishalaya Saha - avatar
+ 2
program pr3; uses crt; var k, sum, a: extended; begin clrscr; sum:=0; k:=1; a:=1; while k<=64 do begin sum:= sum+a; a:=a*2; k:=k+1; end; writeln('sum=', sum:25:0); readln; end.Program Zerno; uses crt; Var s,k:extended; i:byte; Const n=64; Begin s:=1; clrscr; for i:=1 to n-1 do Begin k:=exp(i*ln(2)); s:=s+k; End; Writeln('Zerna: ',s:25:0,' shtuk'); Readln;
9th Nov 2018, 4:22 PM
Sara H
Sara H - avatar
+ 1
Kishalaya Saha I could not have said better šŸ˜‰
9th Nov 2018, 6:54 PM
KrOW
KrOW - avatar
0
my attempt is written in Pascal. I don't know how to write it in Python
9th Nov 2018, 4:17 PM
Sara H
Sara H - avatar
0
Post it and explain what you dont know for convert it in python
9th Nov 2018, 4:22 PM
KrOW
KrOW - avatar
0
Š­Ń…Ń…
9th Nov 2018, 4:27 PM
Sara H
Sara H - avatar
0
Where you have difficulty to "convert" to python?
9th Nov 2018, 4:35 PM
KrOW
KrOW - avatar
0
you don't know how to write this program either? If you know , write at least the first couple of rows. I do not understand how to get the sum of degrees 2 in Python ,and the steppes must be 64
9th Nov 2018, 4:43 PM
Sara H
Sara H - avatar