可怜的多校5555,只做了一道,然后补了两个很简单的题,哭晕

3-1Sqrt Bo

Problem Description
Let's define the function  f(n)=n .

Bo wanted to know the minimum number  y  which satisfies  fy(n)=1 .

note: f1(n)=f(n),fy(n)=f(fy1(n))

It is a pity that Bo can only use 1 unit of time to calculate this function each time.

And Bo is impatient, he cannot stand waiting for longer than 5 units of time.

So Bo wants to know if he can solve this problem in 5 units of time.  

Input
This problem has multi test cases(no more than  120 ).

Each test case contains a non-negative integer  n(n<10100) .  

Output
For each test case print a integer - the answer  y  or a string "TAT" - Bo can't solve this problem.
 
Sample Input
  
  
233 233333333333333333333333333333333333333333333333333333333
 
Sample Output
  
  
3 TAT
tips :就做了这么一道题,而且当时竟然还没有思路。相当于给一个很大很大的数。判断能否在5次之内不停开方得到的整数下界为1。我最终的想法还是找了规律,例如、开五次方得到1的最大值是2^32-1。
Why?试想比二小一点的数下界不就是一了吗,所以根号2是一次,2^2需要两次,4^2需要三次,以此类推。
然后处理数据时也耽误时间了。本来是商量好思路就让队友写的,其实这也就是很简单的大数,甚至比以前的大数都要简单。直接以字符串的形式读的,一直控制在 long long范围内,最后直接上if判断,感觉还是挺快的。队友竟然用了java还wa了两次,比较难过。唉~
code:
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>

using namespace std;

int main()
{
    string a;
    while(cin>>a)
    {
        if(a.length()>10)
            cout<<"TAT"<<endl;
        else
    {
    long long shu=0;
    long long linshi=1;
    for(int i=a.length()-1;i>=0;i--)
    {
       shu+=(a[i]-'0')*linshi;
       linshi*=10;
    }
    if(shu>=1&&shu<4)
        cout<<1<<endl;
    else if(shu>=4&&shu<16)
        cout<<2<<endl;
    else if(shu>=16&&shu<256)
        cout<<3<<endl;
    else if(shu>=256&&shu<65536)
        cout<<4<<endl;
    else if(shu>=65536&&shu<4294967296)
        cout<<5<<endl;
    else
        cout<<"TAT"<<endl;
    }
    }
}

3-10Rower Bo

Problem Description
There is a river on the Cartesian coordinate system,the river is flowing along the x-axis direction.

Rower Bo is placed at  (0,a)  at first.He wants to get to origin  (0,0)  by boat.Boat speed relative to water is  v1 ,and the speed of the water flow is  v2 .He will adjust the direction of  v1  to origin all the time.

Your task is to calculate how much time he will use to get to origin.Your answer should be rounded to four decimal places.

If he can't arrive origin anyway,print"Infinity"(without quotation marks).
 

Input
There are several test cases. (no more than 1000)

For each test case,there is only one line containing three integers  a,v1,v2 .

0a100 0v1,v2,100 a,v1,v2  are integers
 

Output
For each test case,print a string or a real number.

If the absolute error between your answer and the standard answer is no more than  104 , your solution will be accepted.
 
Sample Input
   
   
2 3 3 2 4 3
 
Sample Output
   
   
Infinity 1.1428571429

tips :中学物理题,怀念吧。一直找规律,没找到,这也不能怪别人。做题多了当然规律也更容易看,其实正解是解微分方程。说实话还是有难度的。但是最后的结果是真TMD的简单啊,t=a*v1/(v1^2-v2^2)。感兴趣的自己看看大神的解释。

1010 Rower Bo

首先这个题微分方程强解显然是可以的,但是可以发现如果设参比较巧妙就能得到很方便的做法。

先分解v_1v1

Alt text

设船到原点的距离是rr,容易列出方程

\frac{ dr}{ dt}=v_2\cos \theta-v_1dtdr=v2cosθv1

\frac{ dx}{ dt}=v_2-v_1\cos \thetadtdx=v2v1cosθ

上下界都是清晰的,定积分一下:

0-a=v_2\int_0^T\cos\theta{ d}t-v_1T0a=v20Tcosθdtv1T

0-0=v_2T-v_1\int_0^T\cos\theta{ d}t00=v2Tv10Tcosθdt

直接把第一个式子代到第二个里面

v_2T=\frac{v_1}{v_2}(-a+v_1T)v2T=v2v1(a+v1T)

T=\frac{v_1a}{{v_1}^2-{v_2}^2}T=v12v22v1a

这样就很Simple地解完了,到达不了的情况就是v_1< v_2v1<v2(或者a>0a>0v_1=v_2v1=v2)。

代码没必要上了,直接套公式。

Teacher Bo

Problem Description
Teacher BoBo is a geography teacher in the school.One day in his class,he marked  N  points in the map,the  i -th point is at  (Xi,Yi) .He wonders,whether there is a tetrad  (A,B,C,D)(A<B,C<D,ACorBD)  such that the manhattan distance between A and B is equal to the manhattan distance between C and D.
If there exists such tetrad,print "YES",else print "NO".

Input
First line, an integer  T . There are  T  test cases. (T50)
In each test case,the first line contains two intergers, N, M, means the number of points and the range of the coordinates. (N,M105) .
Next N lines, the  i -th line shows the coordinate of the  i -th point. (Xi,Yi)(0Xi,YiM) .

Output
T  lines, each line is "YES" or "NO".

Sample Input
   
   
2 3 10 1 1 2 2 3 3 4 10 8 8 2 3 3 3 4 4

Sample Output
   
   
YES NO
tips :曼哈顿距离毛神前几天刚说过,所以才知道有这个公式。d(i,j)= |Xi-Xj| +|Yi-Yj|.可是为啥当时就没想到用暴力呢?只想着:哎呀,我不会搜索,不会数据结构,这题没法做啊。我真是太笨了,恩,决定了,以后一定要勤加练习数据结构。代码没有结构让自己看着人都难受。言归正传,核心就是一个记录数组和结构体,哨兵值判断Yes/No。

code:

#include<iostream>
#include<cstring>
#include<cmath>
using namespace std;
struct h
{
    int x,y;
} re[100010];

int man(int i,int j)
{
    int hui=abs(re[i].x-re[j].x)+abs(re[i].y-re[j].y);
    return hui;
}
int main()
{
    int te=0;
    cin>>te;
    while(te--)
    {
        int vis[200020]= {0};
        int sum,jie=0;
        int shao=0;
        cin>>sum>>jie;
        for(int i=0; i<sum; i++)
        {
            cin>>re[i].x>>re[i].y;
            if(i==0||shao==1)
                continue;
            for(int j=0; j<i; j++)
            {
                if(vis[man(i,j)]==0)
                    vis[man(i,j)]=1;
                else
                {
                    shao=1;
                    break;
                }
            }
        }
        if(shao==0)
        {
            cout<<"NO"<<endl;
        }
        else
        {
            cout<<"YES"<<endl;
        }
    }
}

http://acm.hdu.edu.cn/

这是最近打多校的题,没参加的去这个网址上,problems Arc上面最后一页的就是最新的这几道题。还是挺有意思的,估计看这篇博客应该都是没打的吧,打的都去看大神的题解了。敲打

继续努力,好好学习!

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值