• 6月28日 cf总结


    6月28日 cf总结

    今天cf提前到10点了,还不如半夜。。网速坑啊。。。

    A题:水题。

    在一个01序列中每次删掉01和10,求最终剩下的序列的长度。

    直接输出0的个数和1的个数的差即可,因为最终只要剩下0或1就会被和谐掉。

    这题7分钟刷出页面,11分钟看懂题意,13分钟过也是醉了。。。网速坑手速啊。。。

    #include<iostream>
    #include<cstdio>
    #include<cstring>
    #include<cstdlib>
    #include<algorithm>
    #include<vector>
    #include<stack>
    #include<queue>
    #include<set>
    #include<map>
    #include<string>
    #include<math.h>
    #include<cctype>
    #define ll long long
    #define REP(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)
    #define REPP(i,a,b,t) for(int (i)=(a);(i)<=(b);(i)+=(t))
    #define rep(i,a,b) for(int (i)=(a);(i)>=(b);(i)--)
    #define repp(i,a,b,t) for(int (i)=(a);(i)>=(b);(i)-=(t))
    #define PII pair<int,int>
    #define fst first
    #define snd second
    #define MP make_pair
    #define PB push_back
    #define RI(x) scanf("%d",&(x))
    #define RII(x,y) scanf("%d%d",&(x),&(y))
    #define RIII(x,y,z) scanf("%d%d%d",&(x),&(y),&(z))
    #define DRI(x) int (x);scanf("%d",&(x))
    #define DRII(x,y) int (x),(y);scanf("%d%d",&(x),&(y))
    #define DRIII(x,y,z) int (x),(y),(z);scanf("%d%d",&(x),&(y),&(z))
    #define RS(x) scanf("%s",x)
    #define RSS(x,y) scanf("%s%s",x,y)
    #define DRS(x) char x[maxn];scanf("%s",x)
    #define DRSS(x,y) char x[maxn],y[maxn];scanf("%s%s",x,y)
    #define MS0(a) memset((a),0,sizeof((a)))
    #define MS1(a) memset((a),-1,sizeof((a)))
    #define MS(a,b) memset((a),(b),sizeof((a)))
    #define ALL(v) v.begin(),v.end()
    #define SZ(v) (int)(v).size()
    
    using namespace std;
    
    const int maxn=1000100;
    const int INF=(1<<29);
    const double EPS=0.0000000001;
    const double Pi=acos(-1.0);
    
    string s;
    int n;
    
    int main()
    {
        while(cin>>n){
            cin>>s;
            int one=0,zero=0;
            REP(i,0,SZ(s)-1){
                if(s[i]=='0') zero++;
                else one++;
            }
            cout<<abs(one-zero)<<endl;
        }
        return 0;
    }
    View Code

    B题:水题。

    对一组齿轮,问是否能转到0123,,,n的序列。

    由于是齿轮,第一个转+1,第二个-1,第三个+1,第四个-1,...,以此类推。

    因此直接将第一个转到0,即转了-a[0]次,后面的第偶数个转a[0]次,第奇数个转了a[0]次,算出最后状态,最后扫一次判断即可。

    齿轮啊,无语啊。。。居然去找规律。。。。直接模拟啊。。。。自己傻逼啊。。。。。

    #include<iostream>
    #include<cstdio>
    #include<cstring>
    #include<cstdlib>
    #include<algorithm>
    #include<vector>
    #include<stack>
    #include<queue>
    #include<set>
    #include<map>
    #include<string>
    #include<math.h>
    #include<cctype>
    #define ll long long
    #define REP(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)
    #define REPP(i,a,b,t) for(int (i)=(a);(i)<=(b);(i)+=(t))
    #define rep(i,a,b) for(int (i)=(a);(i)>=(b);(i)--)
    #define repp(i,a,b,t) for(int (i)=(a);(i)>=(b);(i)-=(t))
    #define PII pair<int,int>
    #define fst first
    #define snd second
    #define MP make_pair
    #define PB push_back
    #define RI(x) scanf("%d",&(x))
    #define RII(x,y) scanf("%d%d",&(x),&(y))
    #define RIII(x,y,z) scanf("%d%d%d",&(x),&(y),&(z))
    #define DRI(x) int (x);scanf("%d",&(x))
    #define DRII(x,y) int (x),(y);scanf("%d%d",&(x),&(y))
    #define DRIII(x,y,z) int (x),(y),(z);scanf("%d%d",&(x),&(y),&(z))
    #define RS(x) scanf("%s",x)
    #define RSS(x,y) scanf("%s%s",x,y)
    #define DRS(x) char x[maxn];scanf("%s",x)
    #define DRSS(x,y) char x[maxn],y[maxn];scanf("%s%s",x,y)
    #define MS0(a) memset((a),0,sizeof((a)))
    #define MS1(a) memset((a),-1,sizeof((a)))
    #define MS(a,b) memset((a),(b),sizeof((a)))
    #define ALL(v) v.begin(),v.end()
    #define SZ(v) (int)(v).size()
    
    using namespace std;
    
    const int maxn=1000100;
    const int INF=(1<<29);
    const double EPS=0.0000000001;
    const double Pi=acos(-1.0);
    
    int a[maxn];
    int n;
    
    int main()
    {
        while(cin>>n){
            REP(i,0,n-1) RI(a[i]);
            bool flag=1;
            int t=a[0];
            REP(i,0,n-1){
                if(i&1) a[i]=(a[i]+t)%n;
                else a[i]=(a[i]+n-t)%n;
            }
            REP(i,0,n-1){
                if(a[i]!=i){
                    flag=0;
                    break;
                }
            }
            puts(flag?"YES":"NO");
        }
        return 0;
    }
    View Code

    C题:水题。

    即俄罗斯套娃,大的能套小的,前提是大的没有被别的套且没有套别的东西,因此想套一条链只能从小到大套,不能从大到小套。

    然后给出几个已经套完的链,求重组使套成1->2->...->n的链的操作数。

    由于只能从小到大套,所以直接模拟即可,建图(链)后从小到大判断,结果为需要添加的操作数+需要删除的操作数。

    题意坑啊。。。。。赛后知道题意秒A啊。。。。。

    #include<iostream>
    #include<cstdio>
    #include<cstring>
    #include<cstdlib>
    #include<algorithm>
    #include<vector>
    #include<stack>
    #include<queue>
    #include<set>
    #include<map>
    #include<string>
    #include<math.h>
    #include<cctype>
    #define ll long long
    #define REP(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)
    #define REPP(i,a,b,t) for(int (i)=(a);(i)<=(b);(i)+=(t))
    #define rep(i,a,b) for(int (i)=(a);(i)>=(b);(i)--)
    #define repp(i,a,b,t) for(int (i)=(a);(i)>=(b);(i)-=(t))
    #define PII pair<int,int>
    #define fst first
    #define snd second
    #define MP make_pair
    #define PB push_back
    #define RI(x) scanf("%d",&(x))
    #define RII(x,y) scanf("%d%d",&(x),&(y))
    #define RIII(x,y,z) scanf("%d%d%d",&(x),&(y),&(z))
    #define DRI(x) int (x);scanf("%d",&(x))
    #define DRII(x,y) int (x),(y);scanf("%d%d",&(x),&(y))
    #define DRIII(x,y,z) int (x),(y),(z);scanf("%d%d",&(x),&(y),&(z))
    #define RS(x) scanf("%s",x)
    #define RSS(x,y) scanf("%s%s",x,y)
    #define DRS(x) char x[maxn];scanf("%s",x)
    #define DRSS(x,y) char x[maxn],y[maxn];scanf("%s%s",x,y)
    #define MS0(a) memset((a),0,sizeof((a)))
    #define MS1(a) memset((a),-1,sizeof((a)))
    #define MS(a,b) memset((a),(b),sizeof((a)))
    #define ALL(v) v.begin(),v.end()
    #define SZ(v) (int)(v).size()
    
    using namespace std;
    
    const int maxn=1000100;
    const int INF=(1<<29);
    const double EPS=0.0000000001;
    const double Pi=acos(-1.0);
    
    int n,k,m;
    int a[maxn];
    map<PII,int> G;
    
    int main()
    {
        while(cin>>n>>k){
            G.clear();
            int A=0,B=0,cnt=0;
            while(k--){
                RI(m);
                cnt+=m-1;
                REP(i,1,m) RI(a[i]);
                REP(i,1,m-1) G[{a[i],a[i+1]}]=1;
            }
            REP(i,1,n-1){
                if(G[{i,i+1}]) A++;
                else break;
            }
            cout<<(n-1-A)+(cnt-A)<<endl;
        }
        return 0;
    }
    View Code

    要是网速好脑子不傻逼,题意看懂,随随便便秒A啊。。。。随随便便rank前200啊,冲紫很随便啊。。。

    看来单词得背啊,英语阅读还得练啊。。。

    虽然这次rating又跌了。。但是感觉距离冲紫也不远了。。。下次注册个新帐号,反正xd560前缀非常非常不好,当时脑残怎么会在前面加上这个傻逼学校作前缀。。。下场换号冲紫!!!

    没有AC不了的题,只有不努力的ACMER!
  • 相关阅读:
    HDU ACM 1071 The area 定积分计算
    Effective C++:条款25:考虑写出一个不抛异常的swap函数
    史上最全站点降权原因解析
    shell脚本中的数学运算
    Spark 1.0.0 横空出世 Spark on Yarn 部署(Hadoop 2.4)
    索尼 LT26I刷机包 X.I.D 增加官方风格 GF A3.9.4 各方面完美
    Swift基础--使用TableViewController自己定义列表
    勒索软件出新招,小心你的隐私和財产安全!
    Http协议具体解释
    Android Studio解决unspecified on project app resolves to an APK archive which is not supported
  • 原文地址:https://www.cnblogs.com/--560/p/4605041.html
Copyright © 2020-2023  润新知