P10765 「CROI · R2」在相思树下 I

P10765 「CROI · R2」在相思树下 I - 洛谷 | 计算机科学教育新生态 (luogu.com.cn)

挺简单一题,看看规律即可。

#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
typedef long long LL;
const int N = 70;
LL n, m;
int g[N];
int main()
{
int T;
cin >> T;
while (T -- )
{
cin >> n >> m;
for (int i = 1; i <= m; i ++ ) cin >> g[i];
LL res = 1;
for (int i = m; i; i -- )
{
res *= 2;
if (g[i] == 2) res -- ;
}
cout << res << endl;
}
return 0;
}
posted @   blind5883  阅读(16)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 地球OL攻略 —— 某应届生求职总结
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 提示词工程——AI应用必不可少的技术
· .NET周刊【3月第1期 2025-03-02】
点击右上角即可分享
微信分享提示