ACM ICPC 2017 Warmup Contest 2[菜鸡选手的成长]

(队友去过节了 丢下我一个人单挑差点暴零,太菜了.....补题之路 路阻且长)

A

算是水题吧,直接找两个随便割一下,画下图就好....

#include <bits/stdc++.h>
using namespace std;
typedef struct node{
    int x;int y;
}node;
node a[3];
int main(){
   int n,m;
   scanf("%d%d",&n,&m);
   for(int i=1;i<=2;i++) scanf("%d%d",&a[i].x,&a[i].y);
   if(a[1].x==a[2].x){
     printf("%d %d %d %d\n",0,a[1].y,n,a[2].y);
   }
   else{
        printf("%d %d %d %d\n",a[1].x,0,a[2].x,m);
   }
   return 0;
}

K:按照题意模拟即可

#include <bits/stdc++.h>
using namespace std;
typedef struct node{
    int x,y,z;int biao;
    friend bool operator<(node a,node b){
        if(a.z==b.z){
            if(a.y==b.y) return a.x>b.x;
            return a.y>b.y;
        }
        return a.z>b.z;
    }
}node;
node a[105];
int main(){
    node t;
    cin>>t.x>>t.y>>t.z;
    int tt;cin>>tt;
    int ans=0;
    for(int i=1;i<=tt;i++) {cin>>a[i].x>>a[i].y>>a[i].z;a[i].biao=i;}
    sort(a+1,a+tt+1);
    for(int i=1;i<=tt;i++){
        if(a[i].z+18<t.z) {ans=a[i].biao;break;}
        else if(a[i].z+18==t.z){
            if(a[i].y<t.y) {ans=a[i].biao;break;}
            else if(a[i].y==t.y){
                if(a[i].x<=t.x) {ans=a[i].biao;break;}
            }
        }
    }
    if(ans==0) cout<<"-1"<<endl;
    else cout<<ans<<endl;
   // cout<<ans<<endl;
    return 0;
}

F:折叠问题 看懂题 然后模拟...推一下

#include <bits/stdc++.h>
using namespace std;
int main(){
    int x1,x2;int t1,t2;
    cin>>x1>>x2>>t1>>t2;
    if(x1<x2) swap(x1,x2);
    if(t1<t2) swap(t1,t2);
    if(x1<t1||x2<t2) cout<<"-1"<<endl;
    else{
        int ans=0;
        int xx1=x1;int xx2=x2;
        if(xx1!=t1){
        while(1){
            if(xx1&1){
                if((xx1>>1)+1<=t1) {ans++;break;}
                else {ans++;xx1=(xx1>>1)+1;}
            }
            else{
                if((xx1>>1)<=t1) {ans++;break;}
                else {ans++;xx1=(xx1>>1);}
            }
         }
      }
      if(xx2!=t2){
            while(1){
            if(xx2&1){
                if((xx2>>1)+1<=t2) {ans++;break;}
                else {ans++;xx2=(xx2>>1)+1;}
            }
            else{
                if((xx2>>1)<=t2) {ans++;break;}
                else {ans++;xx2=(xx2>>1);}
            }
         }
      }
      int ans1=0;swap(t1,t2);xx1=x1;xx2=x2;
              if(xx1!=t1){
        while(1){
            if(xx1&1){
                if((xx1>>1)+1<=t1) {ans1++;break;}
                else {ans1++;xx1=(xx1>>1)+1;}
            }
            else{
                if((xx1>>1)<=t1) {ans1++;break;}
                else {ans1++;xx1=(xx1>>1);}
            }
         }
      }
      if(xx2!=t2){
            while(1){
            if(xx2&1){
                if((xx2>>1)+1<=t2) {ans1++;break;}
                else {ans1++;xx2=(xx2>>1)+1;}
            }
            else{
                if((xx2>>1)<=t2) {ans1++;break;}
                else {ans1++;xx2=(xx2>>1);}
            }
         }
      }
      ans=min(ans1,ans);
      cout<<ans<<endl;
    }
    return 0;
}

G:待补

posted @ 2017-10-04 20:34  wang9897  阅读(189)  评论(0编辑  收藏  举报