2017_05_21(第一次随机组队赛杂记(全是飞机的题目))

来源:互联网 发布:最短路径的floyd算法 编辑:程序博客网 时间:2024/05/22 03:40

。。。

很久没有打组队赛,今天随机分配打的组队赛,居然在三道水题上面浪费了那么多时间,

尤其是第一道题虽然说是题目的输出格式错误,但是我们也wa了十几次,完全就是在瞎搞,错了之后,错6次以后才开始怀疑自己算法有问题,但是还是wa掉了;

又控制精度还是wa,xyk已经开始心态崩了,还有一个水题,题意一直没有读懂,


A题

Input
The only line contains the integers h, t, v, and x (5 000 ≤ h ≤ 12 000; 50 ≤ t ≤ 1 200; 1 ≤x < v ≤ 100; ht · v).
Output
Output two real numbers, which are the minimum and maximum numbers of seconds during which passengers may have their ears blocked. The absolute or relative error of each number should not exceed 10−6.
Example
inputoutput
10000 500 50 10
125.0 500.0

描述一下坑,A    输出不用保留一位小数,样例是错的,还有飞机的速度最小是0,不是1。。fuck!

坑爹的题!!!你的良心不会痛吗!!!唉!

代码

#include <iostream>#include <algorithm>#include <cstring>#include <string>#include <vector>#include <cstdio>using namespace std;int main(){    double h,t,maxv,x;    cin >> h  >> t >> maxv >> x;    double xx = h/t;    double mint;    if(xx <= x)        mint = 0;    else        mint = (h - x*t)/(maxv - x);    double maxt;    if(xx > x)    {        maxt = t;    }    else    {        maxt = h/(x);//wadian }    printf("%lf %lf\n",mint,maxt);//原来%.1lf    return 0;}


对于E题;

E题的题意是说,他听出来了有n个单词,下面说这n个单词的语言,有的语言不知道,有的语言可以知道,但是连续的x个必然是属于同一种语言,所以所有可能的预言数必然是n的因子,并且将这n个单词以因子为个数分组后,每组为一种语言,如果可以这样分,那么就输出这种语言数,如果不存在那么就输出Igor is wrong.

例如第一组,他可以有1,2,3,6种语言,对应6,3,2,1个为一种语言的单词,

6englishunknownunknownunknowngermanunknown
但6个为一组是错的,因为他听出来了另一种语言;

3个为一组是可以的,前三个单词是English;最后三个是german;一共2种语言

2个为一组,前三个单词是English; 中间两个 (sss某种语言);最后两个german;一共3种语言

同理1个为一组,,6种语言


注意只要是相同 的语言它一定在同一组里面,并且中间不会出现其他的语言,但有unknown是可以的)

代码如下

#include <iostream>#include<cstdio>#include<vector>#include<string>#include<map>#include<cstring>using namespace std;const int maxn=1000+5;vector<int> yinzi[maxn];map<string,int>num,id;string dui[maxn];vector<int> ch[maxn];vector<int >ans;int vis[maxn];int main(){    for(int i=1;i<=1000;i++)        for(int j=i;j<=1000;j+=i)          yinzi[j].push_back(i);    int n;    cin>>n;    int na=0;    for(int i=0;i<maxn;i++)        ch[i].clear();    num.clear();    int flag=0;    for(int i=1;i<=n;i++)    {        string s;        cin>>s;        num[s]++;        dui[i]=s;        if(s!="unknown"&&num[s]==1)        {               na++;               id[s]=na;        }        if(s!="unknown"&&num[s])        {            if(id[s]!=na)               flag=2;        }        if(s!="unknown")        {           ch[id[s]].push_back(i);        }    }  //  cout<<"na="<<na<<endl;    if(flag==0)    for(int i=0;i<yinzi[n].size();i++)    {        int l=yinzi[n][i];        int jj=0;        memset(vis,0,sizeof(vis));        for(int j=1;j<=n;j+=l)        {            int ng=0;            string g;            for(int k=0;k<l;k++)            {                if(dui[j+k]=="unknown")                    continue;                else                {                     if(!ng)                       {                           g=dui[j+k];                           vis[id[g]]++;                           if(vis[id[g]]>1)                           {                               jj=1;                               break;                           }                       }                     else                     {                        if(dui[j+k]!=g)                        {                            jj=1;                            break;                        }                     }                     ng++;                }            }            if(jj)                break;        }        if(!jj)        {            flag=1;            ans.push_back(n/l);        }    }    if(ans.size()&&flag==1)    for(int i=ans.size()-1;i>=0;i--)    {        cout << ans[i];        if(i==0)            cout<<endl;        else            cout<<" ";    }    else        cout<<"Igor is wrong."<<endl;    return 0;}



原创粉丝点击