zoukankan      html  css  js  c++  java
  • 2019 年华东师范大学机试

     没有经过数据的检验,如果有错误欢迎指正

    找规律后可以找到这个。

    #include <bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    const ll inf = 0x3f3f3f3f;
    const double eps = 1e-6;
    const ll N = 1e5+7;
    int main(){
        ll a,g,c,k; cin>>a>>g>>c>>k;
        if(k&1){
            cout<<g-a<<endl;
        }else{
            cout<<a-g<<endl;
        }
        return 0;
    }

    固定任意一条边(我这里用了最大 然后二分角度)

    #include <bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    const ll inf = 0x3f3f3f3f;
    const double eps = 1e-9;
    const double pi = acos(-1.0);
    const ll N = 1e5+7;
    vector<int> v;
    double len(double x1,double y1,double x2,double y2){
        double x=(x2-x1)*(x2-x1);
        double y=(y2-y1)*(y2-y1);
        return sqrt(x+y);
    }
    int sgn(double x){
        if(fabs(x) < eps)return 0;
        if(x < 0)return -1;
        else return 1;
    }
    int main(){
        int x;
        for(int i=0;i<3;i++){
            cin>>x;
            v.push_back(x);
        }
        sort(v.begin(),v.end());
        double l,r;
        l=0; r=pi/2;
        double ansx,ansy;
        //cout<<asin(3.0/5)<<endl;
        while(1){
            double mid=(l+r)/2;
            double xx=v[1]*cos(mid);
            double yy=v[1]*sin(mid);
            //cout<<mid<<" "<<len(xx,yy,v[2],0)<<" "<<v[0]<<endl;
            if(sgn(len(xx,yy,v[2],0)-v[0])==0){
                ansx=xx;
                ansy=yy;
                //cout<<ansx<<" "<<ansy<<endl;
                break;
            }else{
                if(sgn(len(xx,yy,v[2],0)-v[0])==1){
                    r=mid;
                }else{
                    l=mid;
                }
            }
        }
        cout<<"0 0"<<endl;
        cout<<v[2]<<" 0"<<endl;
        //cout<<ansx<<endl;
        printf("%.1f %.1f
    ",ansx,ansy);
        //cout<<ansx<<" "<<ansy<<endl;
        return 0;
    }

     

    模拟即可

    #include <bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    const ll inf = 0x3f3f3f3f;
    const double eps = 1e-6;
    const ll N = 1e5+7;
    int ans[107];
    int main(){
        int k; string s;
        cin>>k>>s;
        for(int i=0;i<s.length();i++){
            ans[i%k]+=s[i]-'0';
        }
        int c=0;
    //    for(int i=0;i<k;i++){
    //        cout<<ans[i];
    //    }
        while(1){
            for(int i=k-1;i>=0;i--){
                int tmp=(ans[i]+c)%2;
                c=(ans[i]+c)/2;
                ans[i]=tmp;
            }
            if(c==0) break;
        }
        for(int i=0;i<k;i++){
            cout<<(!ans[i]);
        }
        cout<<endl;
        return 0;
    }
    //4
    //101101100111
    //0110
    
    //16
    //1111111111111111
    //0000000000000000
    
    //16
    //10100000110000111110100101001000
    //0111010111110011

     

    待做

  • 相关阅读:
    Map,Multimap,Set,MultiSet,Hash_Map,Hash_Set,Share_ptr的区分
    mjpgstreamer源码分析
    S3C2410x介绍
    V4L2应用程序框架
    V4L2驱动框架
    Linux 视频设备驱动V4L2最常用的控制命令使用说明
    (转)在eclipse中查看android SDK的源代码
    [经验技巧] 利用WindowsPhone7_SDK_Full.rar_for_xp,在xp下安装sdk,部署xap软件的教程
    (收藏)智能手机开发
    Html5相关文章链接
  • 原文地址:https://www.cnblogs.com/wmj6/p/14332389.html
Copyright © 2011-2022 走看看