Trang chủ Tin Học Lớp 6 Cánh Diều - POW - Luỹ thừa Input: bàn phím...

Cánh Diều - POW - Luỹ thừa Input: bàn phím Output màn hình Giới hạn thời gian: 1.0s Giới hạn bộ nhớ: 256M Sử dụng hàm pow có sẵn trong thư viện để tính a"

Câu hỏi :

làm full giúp mình 

image

Cánh Diều - POW - Luỹ thừa Input: bàn phím Output màn hình Giới hạn thời gian: 1.0s Giới hạn bộ nhớ: 256M Sử dụng hàm pow có sẵn trong thư viện để tính a"

Lời giải 1 :

#include <bits/stdc++.h>
using namespace std;
string a;
int n,i,m;
string lt( string a, int m){
    int i,t=0,x; char ch; string s;
    for ( i=a.size()-1; i>=0; i--){
        x=(a[i]+0)-48;
        t+=x*m;
        ch=char( t%10+48);
        a[i]=ch;
        t/=10;
    }
    if ( t!=0) {
        s=to_string( t);
        a=s+a;
    }
    return a;
}
int main(){
    cin >> a >> n;
    m=atoi( a.c_str());
    for ( i=1; i<n; i++) a=lt( a, m);
    cout << a;
}/*
                                            .LBBBQBBBM.
                                            :BBBEY::.:LBBR   :JMQBQBQBu.
                                           uBR:         BB1XBBBgbI2UXMBBB
                                        .:BBQbEBQBQBQBBgBBBBP:         PBB
                                  .7dBBQBQBBMZDhX2UJ1JuJjudMBBBBDY:     BB.
                               iZBBBQBKL::..     . . . .    .:r2MBBBI:.KBB
                            rBBBB5r.      ..:.:.:.:.:.:::.:....  .rEBBBB:
                         .EBQBs: ..        :::::::::::::::::::::... .vMBQi
                        MBBX: ....:        ::::::::::::::::::::::::..  :QBBr
                      ZBQI. ...:::::.     .:::::::::::::::::::::::::.:.. rQBB
                    2BBv. ..:::::.:.:bBBBg:.:::::::::::::::::::::::::::.. .bBB7
                  .BBI  .::::::::..vBB7::BB:.:::::::::::::::::::::::::::::. vBBS
                  BB:   :::::::::.7BS     BQ..:::::::::.:.:...:::::::::::::. iBBU
                 bBi   :::::::::..BB     :MB:.::::::...:.:.:::...:::::::::... iBQi
                 BB   ....::::::..BB    BQBB7.:::...:i7LsYjYJsY7i:..::::...    iBQ
                KBj .EBB:..:::::..BB   .BBBBb..:.:rJJ1ssYsLYvsYuJjr..:.. .vZRBMhQBu
                BB..BB.EB:.:::::..BQ    DBBQK ..7suLY7L7L7L7L7LvLLUr:...bQBBBBBBBBBB:
               .BB QB   BM ..:....IB.    7bh...r1JvL7L7v7L7L7L7vvLLu:.:BBd:.    .:1BBD
               .BP.Bv  hBQ....:r:.:b:..:. . ..:rULL7L7v7v7L7L7L7LvjL:.7QB  ......  .BBM
               .BX.B. SBQB..jQRDi....:::::.:::.:vUJYvLvL7L7LvL7LLuJi..:BQ: :.:::::...BQL
               .BZ.Q: 5BBg..Jr....:::::::::::::..:7JjJjYjYjYjs1jJ7:.   LBM ...:.:::. rBBYMBQBQ:
                QB.BL  s2:.....:::::::::::::::..   .:ir77LvL7vri....YBQBBBi  . ..:::. bBQBI1XBQY
                BQ:Pb   ..:::::::::::::::::::.iYvi:  ...........:..rBQs:LQBBMMZv..:::.:QB     BB
               BB7 .::::.:::::::::::::::::::..:jBBQBj..:.:.:.:::::.:QB.   7huj5MS:.::. BQ.    BB.
              BBXi7:.::::::::::::::::::::.:.. .XBQBBK :::::::::::::.7BB7 .. ....:::::..BBi    BQ
             KQBi7Ju.:::::::::::::::::::..  :EBB7:LBZ..::::::::::::. :BB: .:.:.:.::::. RQ:   1QU
             BBYr7jL:.:::::::::::::::.:.. iMBQu:ii:uBg..::::::::::::: :BBL..:::::::::..bBu   QB
            :BQLrJsi.:::::.:::.:.:...  :UBBBLiirr7iiKBs..::::::::::::: :BBb..::::::::: XBQ  EBL
            :BB7Lsi.:::::.i......   :7ZQBX7:ir7r777iiBB .:::::::::::::. .BB:..:::::::. LBD 7BB
             BBu::.:::::.:QMirrLs5dBBBBD:iirr7r777rr:RB7.:::::::::::::.. dBr.::::::::: JQL BB
             DBg  :.:::::.rQBQBQBBBQBBBrir7r7r777r7r:dB2..:::::::::::::. MB7.::::::::. EBjBQ.
             :QBi .:::::::.. .   7MBBBQ7:rr77777r7rr:EB2 :::::::::::..  iBB:.:::::::..:BQDMBQBb
              dBB: .:::::::...:..  :BBBh:i7r777r7r7:iBBi.::::::::..  .7EBBi :::::::...BB:   .QBQ
               MQBi .:.:::::::::.:.  hQB7:i7r7r7rr:iZBP..:::::..  .7bBBBQr :::::::...BQL     iBB.
                XQBI. ..:::::::::::.. 7BBMr:i:i:ii1QB2..:.:... .iKBBBE:rr ..:::::. :BBL     :BBh
                 7BBB7  ...:::::::::.. .UBBBMdbBBBBZ:  ...  .iIBBBg7.  ..:.:::::. rBB    jQBBBi
                   bBQBY:   ....:.:.:...  iJbEdSv.      .rIBBQBMs.  ..:.:::::::.iPBBb    .QQU
                     5BBBB57:.       .            .iYbQBQBQBJ:.. ..:::::::::::..PBiJQB.    BQ
                       :RBBBBBBRMdP2jLsLsLU15hQBBQBBBBBZJ:. ..:.:::::::::::::::..   7BBSY2BQv
                           DBBBBBBBBQBBBQBBBQBBQh2Y7:.  ...:...     .:::::::::::::.. 7QBQBL.
                           BBi  ....:.:::.. DB: . .....:::.           .::::::::::::.. 7QB.
                           BQBj:..........  QB.  . :::::       . .     :::::::::::::.. uBB.
                           BBi  ..:.:::::..:BQ      .i:   .   .   .    .:::::::::::::.. PQB
                           BBY . . ..:.:.. jBB   .   .   . . .   . .   .::::::::::::::.. RBR
                           :BQBBBBRu.      XBL              .   .     .::::::::::::::::...BQb
                             :rSKbBBBBBdhbSBBi   .   . . .   . . .    .:::::::::::::::::. rBB.
                                    :vbQBQBBBi  . .     . . .   .    .:::::::::::::::::::..EBQ
                                           BBv     . . . .   . .   .:i::::::::::::::::::::.iBBr
                                           hBE  . . . . . . . . . :ir:i:i:i:i:i:i:i:i:i:i::.BQB
*/
/*
***********************????**?**??%%%%%%%%%%%%%%%%%%%%%???????????????????????%%%??%?????????%%QQQQQQQQQQQQQQQQQ%%%%%%QQ%%%%%Q%QQ#####Q%%%%%%%%%%%%%%%%QQ###QQQQQQQQQQQQQQQQQQQ#########?++?####QQQQQQQQQQQQQQQQQQQQQQQQQ#Q%%%%%%%%%%%%Q##Q%%%%%%Q########
**********************???*???????%%%%%%%%%%%%%%%%%%%%%%%%???????????????????%%%%???????????%%QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ%QQ#######Q%%%%%%%%QQQQQ%QQ#####QQQQQQQQQQQQQQQQQQ########%*++++*Q####QQQQQQQQQQQQQQQQQQQQQQQ#QQQQ%%%%%%%%%%Q##Q%%%QQQQ#######
*****************?**??*?*??????%%%%%%%%%%%%%%%%%%%%%%%%%%??????????%??????????%???????????%%QQQQQQQQQQQQQQQQQQQ%QQQQQQQQQQ%%Q########Q%QQQ%%%%QQQQ%%Q######QQQQQQQQQQQQQQQQQ########Q*++++++++%####QQQQQQQQQQQQQQQQQQQQQQ##QQQ%%%%%%%%%Q%Q###Q%QQQQ#######
*****?**********??**?*****???%%%%%%%%%%%%%%%%%%%%%%%%%%%%??????%????????????%%%?????????%%QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ%QQ########Q%QQQQQQQQQQQ%QQ#######QQQQQQQQQQQQQQQQ########%+++++++++++?####QQQQQ#QQQQQQQQQQQQQQQ###QQQQQQQQQQQ%%Q####Q%QQ%Q######
************??**????*****???%%%%%%%%%%%%%%%%%%%%%%%%%%%?????????%???????%%%%??????????%%QQQQQQQQQQQQQQQQQQQQ%QQQQ%%%%%%%%Q##########QQ%%%%%QQ%%%QQ########QQQQQQQQQQQQQQQ########Q*+++++++++++++?####QQQQQ#QQQQQQQQQQQQQQQ##Q%Q%%%%%%%%%%%Q####Q%QQQ######
********??????***??*****??%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%?????%???????????%??????????%%%QQQQQQQQQQQQQQQQQQQQQQQQQQ%%%%Q%%Q##########Q%%%%%%QQ%QQQ##########QQQQQQQQQQQQQQ########?+++++++++...++++?#####QQQQ#QQQQQQQQQQQQQQ##Q%Q%%%%%%%%%%%Q#####QQQ%Q#####
*********?************???%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%?????%%%%????%????????????%%%QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ%%QQQ###########QQQQQQQQ%QQ############QQQQQQQQQQQQ########Q*+++++++++.....++++?#####QQQ##QQQQQQQQQQQQQ###QQQ%%%%%%%%%%%Q#####Q%Q%#####
****************?***???%%%%%%%%%%%%%%%%%%%%%?%%%%%%%%%%%%?????????????%?%%%%?%?%%%%%QQQQQQQQ#QQQQQQQQQQQQQQQQQQQQQQQ%Q##########Q#QQQQQQQQQQ#############QQQQQQQQQQQQ########?+++++++++.....*???%*+?#####QQ###QQQQQQQQQQQ####QQQ%%%%%%%%%%%Q######QQQQ####
*****************?*???%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%???????????????%????%%?%?%%%QQQQQQQQQQQQQQQQQQQ%%QQQQQQQQQQQQQQ##########%?#QQQQQQQQQ##############QQQQQQQQQQQ#######Q*++++++++.....*%%%%?****?#####QQ###QQQQQQQQQQ####QQQ%%%%%%%%%%%%Q######QQQ####
*****************???%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%??????????????%???%%?%%%%QQQQQQQQQQQ#QQQQQQQQQQQQQQQQQQQQQ%QQ##########?+%#QQQQQQQQ#########Q####QQQQQQQQQQQ#######%+++++++++...+?%%?*+..*%%%*?####QQ####QQQQQQQQQ####QQQQ%%QQ%QQ%%%%Q######QQQ####
************?*?**?%%%%%%%%%??%%%%%%%???%%%%%%%%%%%%%%?%%?????????????%%??%%%%%QQQQQQQQQQQQQ#QQQQQQQQQQQQQQQQQQQQQQ##########Q*+*##QQQQQQ##########?*####QQ#QQQQQQQ#######?+++++**+..+*??*++***++??*?%Q#####QQ###QQQQQQQQQ#####QQ%%%%%%QQ%%%%Q#######QQQ###
***************??%%%%%%%%%??%%%??%%????%%%%%%%%%%???%?%?????????????????%%%QQQQQQQQQQQQQQQQ#QQQQQQQQQQQQQQQQQQQQQ##########Q*++%#QQQQQQ#########Q*+?####QQQQQQQQ#######Q*+++++*++...+++*??*?%%%%%??*?%Q#####Q####QQQQQQQ######Q%%%%%%%Q#%%%%Q########QQ###
*************???%%%%%%%%????%%%%?%%%??%%%%%%%%%%%%?????????????????????%%Q##QQQQQQQQQQQQQQ#@QQQQQQQQQQQQQQQQQQ#Q##########%++++Q#QQQQQQ########?+++%###QQ#QQQQQ#######Q*+++***+....+.++?%%%??*++...++*QQQ###Q####QQQQQQQ######Q%%%%%%Q##Q%%%Q########QQ###
************??%%%%%%%%%%%%%???%%%??%?%%??%%%%%?%%%????????????????????%%Q###QQQQQQQQQQQQQQ#@QQQQQQQQQQ%Q#QQQQ############?++++*##QQQQQ#######Q*++++Q###QQQQQQQ#######%*+****++...*%%%%?**+....**+..+*%QQ?Q########QQQQQ#######Q%QQ%%%Q##Q%%%Q#############
***********??%%%%%%%%%%%%%%%%%%%%??%??%%%%?????%%??%?????????????????%Q##QQ#QQQQQQQQQQQQQQ#@QQQQQQQQQQQ#QQQQ############?+++++?##QQQQ###@###%++++++Q###Q#QQQQ####@##%++****+.....*Q%?+...*+...+?%%*..+??+?########QQQQQ#######Q%%Q%%Q###Q%%%Q#############
**********??%%%%%%%%%%%%%??%%?%%????%%?????????????????????????????%QQ##QQ##Q#QQQQQQQQQQQQ#@#QQQQQQQQQQ#QQQ############?++++++Q##QQQ#@#####?+++++.+####QQQQQ####@##%******+......+%Q?.**.+??**++**++++%??*Q#######QQQQ########Q%%%%%Q###Q%%%Q#############
********??%%%%%%%%%%%%%%%??%%?%%?%%?????%%????????????????????????%Q###Q###QQQQQQQQQQQQQQQ#@#QQQQQQQQQQ#QQQ#@#########?++++++*###QQ#######?+++++..*#####QQQ#######?*****++.......+??**Q%...*??%%%%%%%%%%%?*########QQ#########Q%%%%Q####Q%%%Q##########@##
*******??%%%%%%%%%%%%%%%%%??%%??%?%?????????????????????????????%Q#########QQQQQQQQQQQQQQQ###QQQQQQQQQ##QQ###########?+++++..*###Q#@#####*++++....*#####QQ#####@#?+****+............*?*++****?%%%%%++++...+%#######QQ#########Q%Q%%Q####Q%%%Q#############
******??%%?%%%%%%%%%%%%%%%%?????????????%??????????????????????%Q##########QQQQQQQQQQQQQQQ###Q%%%QQQQQ#QQ##@########?++++....?##########*++++.....*####QQQ####@#%*****+.................?Q%??*?%%%+........*##################QQ%%Q#####Q%%%Q#############
****??????%%%?%%%%%%%%%%??%??%???????????????????????????????%Q###########Q%QQQQQQQ%%%QQ%Q####Q%QQQQQ##QQ##########*+++++....%########Q*++++......*####QQ####@#%*****+.................+%%*+.+%%?+.........+%################Q%Q%Q######Q%%%Q#############
****?%?%???%%%%?%?%%%%%%?????????%?????????????????????????%%Q############QQQQQQQQ%QQQQQQQ####QQQQQQQ##Q##########*+++++.....%####@##Q*+++........*####Q####@@Q*****+.................+?*+*%%%Q%?**++++...*?*#@##############QQ%Q#######Q%%QQ#############
**???%%%%??%%%%?%%%%%%%%%??%??????????????????????????????%QQ#############QQQQ#QQQQQQQQQQQ#####QQQQQQ############?+++++......%###@@#Q*+++.........+########@@Q*****+..................*+...*Q%??%%%%%%%%%%%%*%@##############QQQ########Q%%%##############
*??%%??%%%%??%%%%%%%%%%%?%%%???%?????????????????????????%Q##############QQQQ##Q%Q%QQQQ%%Q#####QQQQQ############?+++++.......%##@@#Q*+++..........+########@#?***+......................+*%%*+...++********+.+###############QQ########Q%%%%##############
??%%%??%???%?%%%%%%%%%%%%%%??????%%??%????????????????%%QQ#@#############Q%QQ###%%%QQQ#Q%Q#####QQQQQ###########%+++++........?##@@Q**+............+##@#####@%***+....................++*?*+..................+###############Q#########QQQQQ##############
?%%%%?%%%%%%???%%%%%%%%%%%%????????%?????????????????%%Q#################Q%Q####Q%%QQQ#Q%Q######QQQQ##########Q*++++.........?#@@#*++..............Q@@####@Q***+.....................+++.....................+#########################QQQQQ##############
%%%?%%%%%%%%???%?%%%?%%???%%%?%????????????????????%%QQ#################Q%%Q#####Q%QQ%Q#QQ#######QQQ##########?++++..........*#@#**+...............%@@###@#?***..............................................?#@#######################QQQQQ##############
???%????%%%%??%%%%%%?%%%????%??????%??%???????????%%Q###################QQ%Q#####QQQ%%Q#QQ#######QQQ#########Q****+..........+#@?++................?@@##@@%***+..............................................Q@@##%##############@#####QQQQQ##############
???????%%?%%?%%%%%%%%%%%???%?????????????????????%%Q##############Q#####Q%Q#####%+QQQ%Q##Q########QQ########@@@@@#QQQQQQ%%?**+#Q.+.................+#@##@%***+.............................++*??%%QQQQQQQ%%%%#@#Q**#############Q%#####QQQQQ##############
??%%%?%%?%%%%%%%%%%%%%%????%??????????%?%???????%Q################Q####Q%QQ#####%.*QQQQQ#Q########Q#####@###@@@##QQQQ##########Q?*+.................Q@#@Q***+........................+**?%QQ################@@@#*+?############Q*+Q#####QQQQ##############
??%%%%%%%%%??%%?%%%%%%%??????????%?????%%?????%%Q######################Q%Q######Q.`?QQQQ##Q#################@@@Q*******%#QQQQ######Q%?+.............*###***+.....................+*?QQ#############QQQQQQQ##@@Q*++%###########Q*++*#####QQQQQ%%%%%%QQQQQQQ
?%????%%%%%%%??%%%%%%????????????????????????%QQ#######################QQ#######Q+`.%Q%Q##############@#@###%#@@Q*+++++Q#????%%%QQ#####Q%*..........+#@?+**+...............+...+?Q#######QQ%%%%%%#Q++++++%#@#?+++.Q##########Q*++++?####QQQQ%+++++++++++++
%%%??%%%%%%????%%?%?????????????????????????%QQ#######################Q%Q########*``.QQQQ#############@#@##%+*Q###?....*#%*****???%Q#Q####%*...+*+..+Q#++*+..............+*+.+?Q####Q@Q%??*****?%#%....*Q##%+.*+.+##########?**+++++%###QQQQ?+++++++++++++
%%%%%%%?%%%???????%????????????????????????%Q######################Q##QQ#@#######%.``+##Q##################?+++?###Q*...*QQ?*****?Q#?+*?Q###%+..*?+..*%.+*+............+??++?Q###Q%?*%#Q?****?%%#Q+.+*Q##%+..++..*######@#Q*+*?.++++%#@#QQQQ?+++++++++++++
%?%%%%%%??%????????%?????????????????????%%Q#########################QQ@@########Q?.``*#################@##*++..+%###Q%?**%QQQQQQQ%+...+*?Q##Q*..*?*..+.++...........+*??+*Q###Q?*+...*%QQQ%QQQ%*.+?Q##%*....+...%###@#@#?**++*..++?QQQ##QQQ?+++++++++++++
%%%%%%%%?%%????????%%???????????????????%%Q##########################Q###########QQ?.``+###########*Q##@@#Q+*+....*Q############QQ%%%%%%%%Q####%++*%*...++..........+*%?*%####Q%%??******?%%%%%%%Q##Q?+.........+Q##@@#%*+*?*+*...+QQQ*%##QQ?+++++++++++++
%?%%%%%%%?%%???????????????????????????%%Q#############################Q##########QQ?``.?Q#########**Q#@@#%+*+......+***???%%%QQQQQQQQQQQQQ%??*++*??+................+*??**??%%QQQ#############QQ%?+............*##@#Q*+*+.***?...%QQ%++%#QQ?+++++++++++++
%?%%%%%%%??%???????%???????????????????%Q########################Q################QQQ*`+*+%########*+*#@@#?+*+.................................+?*++...................+*?+.......++++++**++++++................%@@#%***+..****..%QQQ*+++%##?+++++++++++++
%%%%%%%%%????????%????????????????????%Q###########################################QQQ?.+*+%##@####*++*#@#?**..................................+.........................++....................................*#@#?**++..+?*?..%#QQQ+++++%#?+++++++++++++
%%%%%%%??????????%%??????????????????%Q######################QQQQQQQ###############Q%Q#?.+*+?#@@###*++.*##**+..................................................................................................Q#%***+..+*??*..%@#QQ?++++++??+++++++++++++
%%%%%%??%???????????????????????????%Q#######################Q#########Q############QQ##?..++*#@@##*++..*#**+.................................................................................................*Q***+...*%?*+.+%@##QQ*+++++++++++++++++++++
%%%?%%%%%??????????????????????????%Q########################Q#QQQQQQ###############QQQ##?....+Q@##?++...%*++.................................................................................................+.+++..+*?*+..+Q@###Q%++++++++++++++++++++++
%%%%%%%%%?????????????????????????%Q########################QQQQQQQ#####Q###########QQQ##@%.....%@@%++...++++.......................................................................................................**+....*######Q%++++++++++++++++++++++
%%%%%%%%%%%??????????????????????%QQ######################QQ##Q#########Q############QQ####%.....*#Q*+.............................................................................................................*?....+?*%@#@###?++++++++++++++++++++++
%%%%%%%%??%??????????????????????%Q####################Q#QQ####QQ####################QQ#####?.....+%?+............................................................................................................+?+...*Q%+*Q##@##?++++++++++++++++++++++
%%%%%%%%%%%?????????????????????%Q################Q#####QQQQQ###Q####################QQ#@###Q?+.....**...........................................................................................................+?+..*%QQ*++*#@@#Q*++++++++++++++++++++++
%%%%%%%%%%%?????????????????????%Q######################QQ###########################QQ#@####QQQQQ%%%Q+.........................................................................................................+?%*?%##Q?++++?#@#Q*++++++++++++++++++++++
%%%%%%%%%%%%????????????????????%Q######################QQ#QQ#QQ###QQ################QQ######QQQQ##@@@%........................................................................................................+*Q###Q#QQ*+++++%@@Q*++++++++++++++++++++++
%%%%%%%%%%%%%%??????????????????%Q######################Q#Q###QQ####Q#################Q######QQQQ######*......................................................................................................+*Q###QQ#Q?+++++++%@#*++++++++++++++++++++++
%%%%%%%%%%%%?%?????????????????%%Q##################QQ##QQQ##QQQQQQQ#################Q###Q%**QQQQ#######+....................................................................................................+*Q@###Q##%*++++++++%Q*+++++++*+*************
%%%%%%%%%%%???%%%??????????????%%Q######################QQQQ####Q######################%*++++?QQQ######@Q+..................................................................................................+*Q@####Q##?++++******?*******************??**
%%%%%%%%%%%???????%?????????????%Q######################QQQQQQ##Q#####################?++++++*QQQ#####@#@%+.............................................+**+++++**+........................................+*%@Q?##QQ#Q*******************+++++++?*+***+++
%%%%%%%%%%%??%??????%???????????%Q########################QQQQQQQ#################%*?%+++++++*QQ#####@####%............................................+*??****???+.......................................+*Q@#**##Q##?***++++++++++++++++++++++*?*+++++++
%%%%%%%%%%%%%????%??????????????%QQ#############################################%*++++++++++++%Q#####@#####%............................................+*****??**+......................................+*Q@@%++Q#QQQ*++++++++++++++++++++++++++??+++++++
%%%%%%%%%%%??????????????????????%Q###########################################%*++++++++++++++%Q##@########@%+...........................................+******+.......................................+*Q###*++%#QQ%+++++++++++++++++++++++++****+++++++
??%%%%%%%%%????%%????????????????%QQ########################################%*++++++++++++++++%Q##@#?Q######@Q*............................................+**++......................................++?Q@##%+++?#QQ*+++++++++++++++++++++++++*?+++++++++
???%%%%%%%%%????%%????????????????%Q######################################%*++++++++++++++++++?Q#@@?+Q#######@#?.....................................................................................+*?#####*+++*QQ?++++++++++++++++++++++++++*?+++++++++
?????%%%%%%%%%??%%%%%%?????????????%Q###################################%*++++++++++++++++++++?##@Q++%#########@Q+..................................................................................+*?#@##@Q++++*QQ*++++++++++++++++++++++++++??+++++++++
****???%%%%%%%%%%%%%%%%?%%%?????????%Q################################%*++++++++++++++++++++++?#@#*++?######@###@#?................................................................................+*%#@@##@?+++++%%+++++++++++++++++++++++++++?*+++++++++
****?**???%%%%%?%%%%%%%%%%%%%%%?????%Q##############################Q?++++++++++++++++++++++++%##*+++?######Q######%+...........................+++++++++++++++++++++............................+*?Q###@###*+++++**+++++++++++++++++++++++++++?*+++++++++
*********???%%%%%%%%%%%%%%%%%%%%?????%Q############################?+++++++++++++++++++++++++*Q#?++++*#####Q*######@Q*+......................+****++++++++++++++*+*******++.....................+*%#####%##Q++++++++++++++++++++++++++++++++++*?++++++++++
*********?????%%%%%%%%%%%%%%%%%%??????%QQ########################Q*++++++++++++++++++++++++++*#%+++++*#####?+%######Q??*................................................+++...................+*??Q####%+Q@%++++++++++++++++++++++++++++++++++*?++++++++++
************????%%%%%%%%%%%%%%%????????%QQ######################?++++++++++++++++++++++++++++?%++++++*####%++*#######**??+...................................................................+*??*#####*+*#?++++++++++++++++++++++++++++++++++?*++++++++++
***********?*??????%%%%%%%%%%%%%%???????%QQ###################Q*+++++++++++++++++++++++++++++?*++++++*###%++++%####@#?**???+...............................................................+*??**%@###%+++%*++++++++++++++++++++++++++++++++++?*++++++++++
**********?********??%%%%%%%%%%%%%????????%Q#################Q*++++++++++++++++++++++++++++++++++++++*#@%+*+++%@@@@@@?*****??+...........................................................+*??****#@@@#*+++**++++++++++++++++++++++++++++++++++?*++++++++++
***********?*********?????%%%%%%%%?????????%Q###############%++++++++++++++++++++++++++++++++++++++++?#Q?**+*#@@@@@@@?+******?*+.......................................................+*??*****?@@@@@Q*+++++++++++++++++++++++++++++++++++++*?*++++++++++
*************************??%%%%%%%??????????%QQ############%++++++++++++++++++++++++++++++++++++++***??+++++*@@@@@@@@?+********??+...................................................+*??*******Q@@@@@@%+++++++++++++++++++++++++++++++++++++*%+++++++++++
***************?************???%%%%??????????%%Q##########?++++++++++++++++++++++++++++++++++++++**+++++++++*@@@@@@@@?++++++*****??*+..............................................+*??********?@@@@@@@%+++++++++++++++++++++++++++++++++++++*?+++++++++++
******************************???%%%?%%???????%%QQ#######?+++++++++++++++++++++++++++++++++++++*?*++++++++++?@@@@@@@@Q**++++++++++*??*+..........................................+??*********++Q@@@@@@@?+++++++++++++++++++++++++++++++++++++?*+++++++++++
*********************************?????%%%%%%%?%%%%QQ####?++++++++++++++++++++++++++++++++++++*?*++++++++++++?@@@@@@@@@@#Q%?**+++++++*??*+.....................................+*??*++*++++++**?@@@@@@@#++++++++++++++++++++++++++++++++++++++?*+++++++++++
******?****************************????%%%%%%%%%%%%%QQ#?+++++++++++++++++++++++++++++++++++*??++++++++++++++?@@@@@@@@@@@@@@@##Q%?**++++*?*+.................................+*?**++++++***?Q#@@@@@@@@@Q++++++++++++++++++++++++++++++++++++++?*+++++++++++
?*****?*******************************????%%%%%%%%%%%Q%??*++++++++++++++++++++++++++++++++*?*+++++++++++++++%@@@@@@@@@@@@@@@@@@@@@@#QQ%?????*+...........................+*******??%QQ##@@@@@@@@@@@@@@%+++++++++++++++++++++++++++++++++++++*?*+++++++++++
?*??**?*??*****************?*************???%%%%%%%%%%%%%??*+++++++++++++++++++++********?*+++++++++++++++++Q@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#%**+++++...............+*?Q#QQQ##@@@@@@@@@@@@@@@@@@@@@@@?+++++++++++++++++++++++++++++++++++++*?++++++++++++
*???*?????**?*******************?**********???%%%%%%%%%%%%%%?**++++++++++++++***???********++++++++++++++++*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@###QQQQ%%%%%%%%%%%%%Q#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*+++++++++++++++++++++++++++++++++++++?*++++++++++++
?????*???**************************************??%%%%%%%%%%%%%??**++++++***??***++++++++++*?+++++++++++++++%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#+++++++++++++++++++++++++++++++++++++*?*++++++++++++
???????????*?????********************************????%%%%%%%%%%%%???*******++++++++++++++++?*++++++++++++++#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@?++++++++++++++++++++++++++++++++++++?*+++++++++++++
????????*???**?????***?******************************???%%%%%%%%%%%%%%?***++++++++++++++++++?*+++++++++++.?@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%..+++++++++++++++++++++++++++++++++*?*+++++++++++++
????????????????????????*???**??**?*********************???%%%%%%%%%??%%?????****++++++++++++?+++++*%%??%%####@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#??%%QQQ%?*+++++++++++++++++++++++++?*++++++++++++++
??????????????**???????????*????*?**???********************?????%%%%?%???%%???????????*****++*?++?Q########QQQQ#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#QQQQQQQQQQ%*+++++++++++++++++++++*?+++++++++++++++
?????????????????????????????????????????????****************???????%%%%??????????????????????%%Q##Q#QQQQ##QQQQQQ#@@@@@@@@@@@@@@@@@@@@@@Q%QQ@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#QQQQQQQQQQ#QQ?*+++++++++++++++++*%*+++++++++++++++
???????????????????????????????????????????????********************???%%%%???????????????????%Q##QQ###QQQ##QQQQQQQQ#@@@@@@@@@@@@@@@@@@@#????%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@QQQQQQQQQQQQQ#Q%*+++++++++++++++?%*+++++++++++++++
*/

Lời giải 2 :

def pow(a, b):
    if b == 0:
        return 1
    ans = pow(a, b // 2)
    if b % 2 == 0:
        return ans * ans
    return ans * ans * a

a, b = map(int, input().split())
print(pow(a, b))

Bạn có biết?

Tin học là một ngành khoa học chuyên nghiên cứu quá trình tự động hóa việc tổ chức, lưu trữ, xử lý và truyền dẫn thông tin của một hệ thống máy tính cụ thể hoặc trừu tượng. Tin học bao hàm tất cả các nghiên cứu và kỹ thuật có liên quan đến việc mô phỏng, biến đổi và tái tạo thông tin. Hãy tận dụng sức mạnh của tin học để giải quyết các vấn đề và sáng tạo ra những giải pháp mới!

Nguồn :

Wikipedia - Bách khoa toàn thư

Tâm sự lớp 6

Lớp 6 - Là năm đầu tiên của cấp trung học cơ sở, chúng ta được sống lại những kỷ niệm như ngày nào còn lần đầu đến lớp 1, được quen bạn mới, ngôi trường mới, một tương lai mới. Hãy tận dụng cơ hội này để làm quen và hòa nhập thật tốt!

Nguồn :

sưu tập

Liên hệ hợp tác hoặc quảng cáo: gmail

Điều khoản dịch vụ

Copyright © 2021 HOCTAPSGK