题解 | 小苯的数字合并

小苯的数字合并

https://www.nowcoder.com/practice/4f466cf5d2d54ab3a8c36004bac6cf49

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod=998244353; 
ll quick(ll a,ll b){
    ll ans=1;
    if(b==0){
        return 1;
    }
    while(b>0){
        if(b&1){
            ans=a*ans%mod;
        }
        b>>=1;
        a=a*a%mod;
    }
    return ans;
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int t;
    cin>>t;
    ll n;
    int x;
    while(t--){
        cin>>n;
        for(int i=0;i<n;i++){
            cin>>x;
        }
        cout<<quick(2,n-1)%mod<<endl;
    }
    return 0;
}

全部评论

相关推荐

程序员小白条:三方不签,不就是纯实习骗人吗,还是小公司,没毛了
点赞 评论 收藏
分享
03-03 19:02
已编辑
东华理工大学 Node.js
点赞 评论 收藏
分享
评论
2
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务