zoukankan      html  css  js  c++  java
  • 6月26日 cf总结

    6月26日 cf总结

    今天写到一半就去水群了。。又浪费了一次冲紫的机会。。今天的C题很简单的。。可惜只顾着水群,题意没看清楚就写了。。。另外AB题的手速还是太慢,B题应该是傻逼一眼题却花了20min,C题题意没看清楚就去水群了,高中的排列组合送分题啊。。。

    A题:水题,不能在5分钟之内看完题目并AC就是慢,当然这次是受网速影响了。

    B题:水题,求翻转列使行的所有数为1的行数的最大值。不管怎么翻转,状态相同的行改变后的状态都是相同的,只要找出状态相同的行的最大个数就可以了,把状态相同的行全部翻转成111...1就可以了。

    #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=1100;
    const int INF=(1<<29);
    const double EPS=0.0000000001;
    const double Pi=acos(-1.0);
    
    string s[maxn];
    map<string,int> m;
    
    int n;
    
    int main()
    {
        while(cin>>n){
            m.clear();
            ll ans=0;
            REP(i,1,n){
                cin>>s[i];
                m[s[i]]++;
                if(m[s[i]]>ans) ans=m[s[i]];
            }
            cout<<ans<<endl;
        }
        return 0;
    }
    View Code

    C题:简单的高中数学排列组合题。首先先提一下一个傻逼的高中知识点,让m个红球和n个蓝球排列,排列种数为C(n+m,n) 即总共有n+m个位置,选择n个位置放蓝球,其余放红球,另一种思路是(n+m)!/n!*m!=C(n+m,n),即用n+m个不同的球全排列,再去掉n个球全排列和m个球全排列的情况。这题要保证第i种球的最后一个在第i+1种球的最后一个的前面,只要一层一层向后推就可以了,先保证最后一个第2种球的位置,剩下的第1种求和第2种求去排列,然后确定最后一个第三种球的位置,剩下第三种球和前面的求排列....以此类推。

    早知道就好好看题不去水群了。。。这题这么简单可惜当时看题意的时候恰好被舍友干扰了,坑,没认真看题意,另外没计算纸就是坑。。。这道题题意看懂很快可以秒的,又错失了一次冲紫的机会。。

    #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);
    const ll p=1000000007;
    
    int k,a[maxn];
    ll s[maxn];
    
    ll qpow(ll n,ll k)
    {
        ll res=1;
        while(k){
            if(k&1) res=(res%p*(n%p))%p;
            n=(n%p)*(n%p)%p;
            k>>=1;
        }
        return res;
    }
    
    ll C(ll n,ll k)
    {
        if(n<k) return 0;
        ll res=1;
        REP(i,1,k){
            ll a=(n-k+i)%p;
            ll b=i%p;
            res=(res*(a*qpow(b,p-2)%p))%p;
        }
        return res%p;
    }
    
    ll lucas(ll n,ll k)
    {
        if(k==0) return 1;
        return (C(n%p,k%p)%p)*(lucas(n/p,k/p)%p)%p;
    }
    
    ll f(ll n,ll m)
    {
        return lucas(n+m,n);
    }
    
    int main()
    {
        while(cin>>k){
            s[0]=0;
            REP(i,1,k) RI(a[i]),s[i]=s[i-1]+a[i];
            ll ans=1;
            REP(i,1,k-1){
                ans=ans*(f(a[i+1]-1,s[i])%p)%p;
            }
            cout<<ans%p<<endl;
        }
        return 0;
    }
    View Code
    没有AC不了的题,只有不努力的ACMER!
  • 相关阅读:
    什么时候用GET?什么时候用POST?
    Oracle存储过程in、out、in out 模式参数
    oracle的spool功能
    xshell-常用命令
    js Date()日期函数浏览器兼容问题解决方法
    spring-quartz
    spring-quartz普通任务与可传参任务
    MySQL服务安装和可视化工具安装
    PL/SQL Developer 查询的数据有乱码或者where 字段名=字段值 查不出来数据
    Windows下安装Redis服务
  • 原文地址:https://www.cnblogs.com/--560/p/4601354.html
Copyright © 2011-2022 走看看