标签:style blog color io for div amp log
水题。不过题目很有趣儿。
1 #include <cstdio> 2 3 #define MAXN 100005 4 5 int a[MAXN]; 6 7 int main() { 8 int t, n, m; 9 int i, j, k, tmp, ans; 10 11 scanf("%d", &t); 12 for (k=1; k<=t; ++k) { 13 scanf("%d %d", &n, &m); 14 for (i=0; i<n; ++i) 15 scanf("%d", &a[i]); 16 ans = 0; 17 for (i=0; i<n; ++i) { 18 tmp = 0; 19 for (j=i; j<n; ++j) { 20 tmp |= a[j]; 21 if (tmp < m) 22 ++ans; 23 else 24 break; 25 } 26 } 27 printf("Case #%d: %d\n", k, ans); 28 } 29 30 return 0; 31 }
【HDOJ】4737 A Bit Fun,布布扣,bubuko.com
标签:style blog color io for div amp log
原文地址:http://www.cnblogs.com/bombe1013/p/3908726.html