zoukankan      html  css  js  c++  java
  • Codeforces Round #443 (Div. 2) 【A、B、C、D】

    Codeforces Round #443 (Div. 2)

    codeforces 879 A. Borya's Diagnosis【水题】

     1 #include<cstdio>
     2 #include<cstring>
     3 #include<algorithm>
     4 using namespace std;
     5 int main(){
     6     int n, t = 0, s, d;
     7     scanf("%d", &n);
     8     while(n--) {
     9         scanf("%d%d", &s, &d);
    10         while(s <= t) {s += d;}
    11         t = s;
    12     }
    13     printf("%d
    ", t);
    14     return 0;
    15 }
    78ms

    codeforces 879 B. Table Tennis【模拟】

    题意:一排n个人,给出每个人的a值,从第一个人开始,每次和后面人比赛,a值大的人赢,输的人走到最后位置去,求先连赢k场的人的a值。

     1 #include<cstdio>
     2 #include<cstring>
     3 #include<algorithm>
     4 using namespace std;
     5 int main(){
     6     long long k;
     7     int n, t = 0, a, ans = 0, cnt = 0, f = 0;
     8     scanf("%d%lld", &n, &k);
     9     while(n--) {
    10         scanf("%d", &a);
    11         if(a < ans) cnt++;
    12         else cnt = 1;
    13         ans = max(ans, a);
    14         if(!f) {cnt = 0;f = 1;}
    15         if(cnt >= k) break;
    16     }
    17     printf("%d
    ", ans);
    18     return 0;
    19 }
    31ms

    codeforces 878 A. Short Program【位运算】

    题意:给出一系列与、或、异或这三种逻辑运算表达式,要对未知数x顺序做这些运算,要你合并运算,输出不超过5行的化简的运算式子。

     1 #include<cstdio>
     2 #include<cstring>
     3 #include<algorithm>
     4 using namespace std;
     5 int n;
     6 int main(){
     7     int i, j, k, f, x;
     8     int cnt = 0;
     9     int a = 0, b = 1023, c = 0;
    10     char s;
    11     scanf("%d", &n);
    12     for(i = 1; i <= n; ++i) {
    13         getchar();
    14         scanf("%c %d", &s, &x);
    15         if(s == '|') {a |= x; b |= x; c &= (1023-x);}
    16         else if(s == '&') {b &= x; c &= x;}
    17         else if(s =='^') {c ^= x; }
    18     }
    19     if(a) cnt++;
    20     if(b != 1023) cnt++;
    21     if(c) cnt++;
    22     printf("%d
    ", cnt);
    23     if(a) printf("| %d
    ", a);
    24     if(b != 1023) printf("& %d
    ", b);
    25     if(c) printf("^ %d
    ", c);
    26     return 0;
    27 }
    156ms

    codeforces 878 B. Teams Formation【模拟】

    题意:长为n的数组a,重复m次形成一个序列,每次动态消去相邻k个相同的数,直到不能消去为止,求最后剩下几个数。

    题解:先将长为n的一列数消除,然后考虑两段连接中间消除。

     1 #include<cstdio>
     2 #include<iostream>
     3 #include<cstring>
     4 #include<algorithm>
     5 using namespace std;
     6 const int N = 100002;
     7 typedef long long ll;
     8 int n, k, m, cnt;
     9 int a[N], b[N], c[N];
    10 ll ans = 0;
    11 int main() {
    12     cnt = 0;
    13     int i, j, o, sum = 0;
    14     int l, r;
    15     scanf("%d%d%d", &n, &k, &m);
    16     for(i = 1; i <= n; ++i) scanf("%d", &a[i]);
    17     for(i = 1; i <= n; ++i) {//第一段序列
    18         if(a[i] != b[cnt]) { b[++cnt] = a[i]; c[cnt] = 1; }
    19         else { c[cnt]++; if(c[cnt] == k) cnt--; }
    20     }
    21     if(!cnt) {puts("0"); return 0;}
    22     for(i = 1; i <= cnt; ++i) sum += c[i];
    23     for(o = 0, i = 1; i < cnt+1-i; ++i) {//相当于两段序列之间
    24         if(b[i] == b[cnt+1-i] && c[i] + c[cnt+1-i] == k) o += k;
    25         else break;
    26     }
    27     if(i<cnt+1-i) {
    28         if(b[i] == b[cnt+1-i] && c[i] + c[cnt+1-i] > k) o += k;
    29         ans = 1ll * sum * m - 1ll * o * (m-1);
    30     }
    31     else {//剩一种数字
    32         ans = 1ll * c[i] * m % k;
    33         if(ans) ans += sum - c[i];//两端的数
    34     }
    35     printf("%lld
    ", ans);
    36     return 0;
    37 }
    31ms
  • 相关阅读:
    MS CRM 2011 RC中的新特性(4)——活动方面之批量编辑、自定义活动
    最近的一些有关MS CRM 2011的更新
    MS CRM 2011 RC中的新特性(6)——连接
    MS CRM 2011 RC中的新特性(7)—仪表板
    参加MS CRM2011深度培训课程——第一天
    MS CRM 2011插件调试工具
    MS CRM2011实体介绍(四)——目标管理方面的实体
    MS CRM 2011 RC中的新特性(3)——客户服务管理方面
    MS CRM 2011 RC中的新特性(8)—数据管理
    ExtAspNet 登陆
  • 原文地址:https://www.cnblogs.com/GraceSkyer/p/7740463.html
Copyright © 2011-2022 走看看