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;
}
标签:R2,P10765,int,res,LL,CROI,include
From: https://www.cnblogs.com/blind5883/p/18301315