洛谷2018.6月赛

  对于初中生来说简直就是阅读理解场,感觉之前自学的高中物理全白学了。

  T1:[物理]平抛运动

  题意概述:怎么概述,我自己还没完全看懂呢...

  事实上是个名副其实的签到题。首先发现了一些公式,然后发现关键就是$t$,只要有了$t$,别的就都可以随便算啦。这时候就发现一个很奇妙的事情,$v_{yt}$好像给了两种表示方法?于是就可以把两种方法联立一下求出$t$来,就愉快的A掉这个题。(自作聪明的我把g当做9.8于是得了一次0分,一定要好好读题!!)竟然看题看了0.5h...

# include <cstdio>
# include <iostream>
# include <cmath>

using namespace std;

double v,th;
double t,vx,vy;
const double g=10.0;

int main()
{
    cin>>v>>th;
    vx=sin(th)*v;
    vy=cos(th)*v;
    t=vy/g;
    printf("%.15lf %.15lf",vx*t,0.5*t*t*g);
    return 0;
}
[物理]平抛运动

  

  T2:[化学]相对分子质量

  题意概述:计算一个分子式的相对分子质量。

  巨型模拟,可与“时间复杂度”一题相媲美。因为这道题,我终于学会了map。现在再去看代码感觉非常佩服自己,如果不是洛谷表示这题没有部分分,我估计就骗一点分就放弃了,但是既然没有部分分,只好强行写了1.5h,写了150行去做这个题。

# include <cstdio>
# include <iostream>
# include <cstring>
# include <string>
# include <map>

using namespace std;

string a,no;
int l,h=0,ans=0,num;
map <string,int> m;

void init()
{
    m["H"]=10;
    m["C"]=120;
    m["N"]=140;
    m["O"]=160;
    m["F"]=190;
    m["Na"]=230;
    m["Mg"]=240;
    m["Al"]=270;
    m["Si"]=280;
    m["P"]=310;
    m["S"]=320;
    m["Cl"]=355;
    m["K"]=390;
    m["Ca"]=400;
    m["Mn"]=550;
    m["Fe"]=560;
    m["Cu"]=640;
    m["Zn"]=650;
    m["Ag"]=1080;
    m["I"]=1270;
    m["Ba"]=1370;
    m["Hf"]=1785;
    m["Pt"]=1950;
    m["Au"]=1970;
    m["Hg"]=2010;
}

int main()
{
    cin>>a;
    l=a.length();
    init();
    h=0;
    no="";
    while (h!=l)
    {
        if(a[h]=='(')
        {
            int s=0;
            h++;
            while (a[h]!=')')
            {
                no="";
                if(a[h]>='A'&&a[h]<='Z')
                {
                    if(a[h+1]<='z'&&a[h+1]>='a') no+=a[h],no+=a[h+1],h++;
                        else no+=a[h];
                }
                if(a[h+1]!='_')
                {
                    s+=m[no];
                    no="";
                }
                else
                {
                    h=h+3;
                    num=0;
                    while (a[h]>='0'&&a[h]<='9')
                    {
                        num=(num<<3)+(num<<1)+(a[h]^48);
                        h++;
                    }
                    s+=num*m[no];
                    no="";
                }
                h++;
            }
            if(a[h+1]!='_')
                ans+=s;
            else
            {
                h=h+3;
                num=0;
                while (a[h]>='0'&&a[h]<='9')
                {
                    num=(num<<3)+(num<<1)+(a[h]^48);
                    h++;
                }
                ans+=num*s;
                no="";
            }
        }
        else  if(a[h]=='~')
        {
            h++;
            if(a[h]=='H')
                ans+=180;
            else
            {
                num=0;
                while (a[h]>='0'&&a[h]<='9')
                {
                    num=(num<<3)+(num<<1)+(a[h]^48);
                    h++;
                }
                ans+=num*180;
                no="";
            }
            h+=5;
        }
        else if(a[h]>='A'&&a[h]<='Z')
        {
            if(a[h+1]<='z'&&a[h+1]>='a') no+=a[h],no+=a[h+1],h++;
            else no+=a[h];
            if(a[h+1]!='_')
            {
                ans+=m[no];
                no="";
            }
            else
            {
                h=h+3;
                num=0;
                while (a[h]>='0'&&a[h]<='9')
                {
                    num=(num<<3)+(num<<1)+(a[h]^48);
                    h++;
                }
                ans+=num*m[no];
                no="";
            }
        }
        h++;            
    }
    if(ans%10) 
        printf("%.1lf",ans*0.1);
    else
        printf("%d",ans/10);
    return 0;
}
[化学]相对分子质量

  T3:[生物]能量流动

  题意概述:食物网上有许多能量在流动!我也概括不了这题在讲啥。

  没做...主要是没有空了,其实是很简单的,本来可以做的,然而T2写的太久。

  T4:[语文]凑字数

  题意最好理解的题没有之一。

  然而我就是不会这也没有什么办法。

  T5:[数学]因子个数和

  题意概述:求一个数的因子的因子的因子的(*k)的因子个数和。

  听讲评的唯一收获就是这道题听懂了一点。$Pollard-rho$和矩阵快速幂/组合数。

  T6:[英语]Z语言

  字符串匹配,听说要用平衡树,那么这道题明年再见吧。

  

  最后展示一下我很23333的成绩:

  

    讲评挺有意思的(打扰了),但是感觉并不能靠讲评听懂不会的题...下次看看电子版题解就行了(感觉月赛讲评有点晚,听到23:00之后感觉神情恍惚)。

   那么,洛谷月赛,下个月再见。

猜你喜欢

转载自www.cnblogs.com/shzr/p/9196742.html