• Codeforces Beta Round #1


    A

    /*************************************************************************
     > File Name: A.cpp
     > Author: opas_chenxin
     > Mail: 1017370773@qq.com 
     > Created Time: 2016年05月06日 星期五 02时22分23秒    
    *************************************************************************/
    #include<iostream>
    #include<algorithm>
    #include<cstdio>
    #include<cstring>
    #include<cmath>
    using namespace std;
    int main(int argc, char *argv[])
    {
        int n,m,a;
        
        while(scanf("%d%d%d",&n,&m,&a) == 3)
        {
            int d1 = (n+a-1)/a;
            int d2 = (m+a-1)/a;
            cout<<1LL*d1*d2<<endl;
        }
        return 0;
    }
    View Code

    B

    /*************************************************************************
     > File Name: B.cpp
     > Author: opas_chenxin
     > Mail: 1017370773@qq.com 
     > Created Time: 2016年05月06日 星期五 20时28分30秒    
    *************************************************************************/
    #include<iostream>
    #include<algorithm>
    #include<cstdio>
    #include<cstring>
    #include<cmath>
    using namespace std;
    const int maxn = 5000000;
    char A[maxn];
    char B[maxn];
    void solve1(int len)
    {
        int a1 = 0;
        int loc = 0;
        while(loc<len)
        {
            if(A[loc] >= 'A' && A[loc] <= 'Z')
            {
                a1 = a1 * 26 + A[loc] - 'A' + 1; 
            }else
            {
                break;
            }
            loc++;
        }
        int b1 = 0;
        while(loc<len)
        {
            b1 = b1*10 + A[loc] -'0';
            loc++;
        }
       printf("R%dC%d
    ",b1,a1);
    }
    void solve2(int len)
    {
      int b1 = 0;
      int loc=1;
      while(loc < len)
      {
        if(A[loc] == 'C') break;
        b1=b1*10+A[loc]-'0';
        loc++;
      }
      loc++;
      int a1 = 0;
      while(loc < len)
      {
          a1 = a1 * 10 + A[loc] - '0';
          loc++;
      }
      loc = 0;
      while(a1>0)
      {
        int v = a1%26;
        char c='Z';
        if(v != 0)
            c = 'A'+ v - 1;
        a1 -= c - 'A' + 1;
        a1 /= 26;
        B[loc ++] = c;
      }
      B[loc]='';
      for(int i = 0; i < loc/2; ++ i)
      {
          char tem = B[i];
          B[i] = B[loc-i-1];
          B[loc - i - 1] = tem;
      }
      printf("%s%d
    ",B,b1);
    }
    int main(int argc, char *argv[])
    {
    //    freopen("in","r",stdin);
        int cas;
        scanf("%d",&cas);
        for(int cc = 1; cc <= cas; ++ cc)
        {
            scanf("%s",A);
            int len = strlen(A);
            int num = 0, per = 0;
            for(int i = 0; i < len; ++ i)
            {
                if(A[i] >= 'A' && A[i] <= 'Z')
                {
                    if(per == 0) 
                    {
                        per = 1;
                        num++;
                    }
                }else{
                    per = 0;
                }
            }
            if(num == 1)
                solve1(len);
            else solve2(len);
        }
        return 0;
    }
    View Code

    C

    /*************************************************************************
     > File Name: C.cpp
     > Author: opas_chenxin
     > Mail: 1017370773@qq.com 
     > Created Time: 2016年06月15日 星期三 19时24分06秒    
    *************************************************************************/
    #include<iostream>
    #include<algorithm>
    #include<cstdio>
    #include<cstring>
    #include<cmath>
    using namespace std;
    #define eps 1e-2
    #define pi acos(-1.0)
    int n,m;
    double s,r,S,p;
    double x[4],y[4],ang[4],L[4];
    double dis(double x1,double y1,double x2,double y2)
    {
        return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
    }
    double gcd(double a,double b)
    {
        if(a<eps) return b;
        if(b<eps) return a;
        return gcd(b,fmod(a,b));
    }
    int main(int argc, char *argv[])
    {
        //freopen("in","r",stdin);
        for(int i=0; i<3; ++i)
        {
            scanf("%lf%lf",&x[i],&y[i]);
            
        }
        for(int i=0; i<3; ++i)
        {
            L[i]=dis(x[i],y[i],x[(i+1)%3],y[(i+1)%3]);
        }
        sort(L,L+3);
        p=(L[0]+L[1]+L[2])/2;
        s=sqrt(p*(p-L[0])*(p-L[1])*(p-L[2]));
        r=L[0]*L[1]*L[2]/(4*s);
        for(int i=0; i<2;++i)
            ang[i]=acos(1-L[i]*L[i]/(2*r*r));
        ang[2]=2*pi-ang[1]-ang[0];
        double unit=0;
        for(int i=0; i<3; ++i)
            unit=gcd(unit,ang[i]);
        printf("%.6f
    ",pi*r*r*sin(unit)/unit);
        return 0;
    }
    View Code
  • 相关阅读:
    牛客算法周周练18A
    洛谷P2580
    Codeforces 617E
    SPOJ 3267
    Codeforces Round #661 (Div. 3) 解题报告(ABCD)
    Codeforces 1399D
    Codeforces 1399C
    Codeforces 1399B
    Codeforces 1399A
    牛客算法周周练18 解题报告(ABCE)
  • 原文地址:https://www.cnblogs.com/Opaser/p/5590283.html
Copyright © 2020-2023  润新知