标签:event .com nbsp stp alt href algo ttl col
A.Little Sub and Pascal‘s Triangle
求帕斯卡三角形第n行(n=0,1,...)的奇数个数
规律:
#include <iostream> #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> typedef long long ll; using namespace std; ll f(ll x){ if(x==0) return 1; ll now=1; while(now*2<=x) now*=2; return 2*f(x-now); } int main() { ll t;scanf("%lld",&t); while(t--){ ll k;scanf("%lld",&k); k--; ll ans=f(k); printf("%lld\n",ans); } return 0; }
标签:event .com nbsp stp alt href algo ttl col
原文地址:https://www.cnblogs.com/lllxq/p/10291488.html