第四届“传智杯”全国大学生IT技能大赛(初赛B组)

复习专业课直接把这茬忘记了,补回去。

一开始做了A组的题目,我说怎么总感觉怪怪的。

~~~~~~~~~~

T216906 组原成绩

#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
    //cin.tie(0); cout.tie(0); ios::sync_with_stdio(false);
    int t,h,e;
    cin>>t>>h>>e;
    cout<<(int)(t*0.2+h*0.3+e*0.5)<<endl;
    return 0;
}

T216907 报告赋分

 输入

2

70 17

80 10

输出

70

70

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
    //cin.tie(0); cout.tie(0); ios::sync_with_stdio(false);
    int t;
    cin>>t;
    while(t--)
    {
        int x,p;
        cin>>x>>p;
        if(p<16) printf("%d\n",x-10<0?0:x-10);
        else if(p>20) printf("%d\n",x-(p-20)*1>0?x-p+20:0);
        else cout<<x<<endl;
    }
    return 0;
}

T216908 竞争得分

输入

3

1 2 3

输出

0 50 100 

#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    int a[200200];
    int maxn=0,minn=2000;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        maxn=max(a[i],maxn);
        minn=min(a[i],minn);
    }
    //cout<<maxn<<minn<<endl;
    for(int i=1;i<=n;i++)
    {
        cout<<(a[i]-minn)*100/(maxn-minn)<<" ";
    }
    cout<<endl;
    return 0;
}

T216909 小卡与质数2

输入

9
5
6
7
8
9
10
100
1000
10000

输出

2
4
4
2
2
4
22
163
1132

 我太菜了,整好久还没整出来,先放放。

改天回来做。

T216910 萝卜数据库

输入

4 5
1 2 1 2 2 4
2 2 1 5
1 2 3 5 4 6
2 4 7 8

输出

1
0

用结构体对vector进行封装 

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<map>
#include<vector>
#include<string>
#include<cstdlib>
#include<cstring>
using namespace std;
struct node
{
    vector<int> v;
}s[1005];
int main()
{
    //cin.tie(0); cout.tie(0); ios::sync_with_stdio(false);
    int n,k;
    cin>>n>>k;//这里的k的作用就是想告诉你它每个字段可以包含的最大数量
    while(n--)
    {
        int a;
        cin>>a;
        if(a==1)
        {
            int p,x,y;
            cin>>p;
            for(int i=1;i<=p;i++)
            {
                cin>>x>>y;//插入操作:第x个字段里面有个y
                s[x].v.push_back(y);
            }
        }
        else if(a==2)
        {
            int sum=0;
            int x,l,r;
            cin>>x>>l>>r;//查找第x个字段里面符合l到r的数字有几个
            for(vector<int>::iterator it=s[x].v.begin();it!=s[x].v.end();it++)
                if(*it>=l && *it<=r) sum++;//cout<<*it<<" ";
            cout<<sum<<endl;
            //v.clear();
        }
    }
    return 0;
}

还是有很多小细节的东西需要注意哇! 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Vijurria

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值