• 1061 判断题 (15 分)


    1061 判断题 (15 分)

    判断题的评判很简单,本题就要求你写个简单的程序帮助老师判题并统计学生们判断题的得分。

    输入格式:

    输入在第一行给出两个不超过 100 的正整数 N 和 M,分别是学生人数和判断题数量。第二行给出 M 个不超过 5 的正整数,是每道题的满分值。第三行给出每道题对应的正确答案,0 代表“非”,1 代表“是”。随后 N 行,每行给出一个学生的解答。数字间均以空格分隔。

    输出格式:

    按照输入的顺序输出每个学生的得分,每个分数占一行。

    输入样例:

    3 6
    2 1 3 3 4 5
    0 0 1 0 1 1
    0 1 1 0 0 1
    1 0 1 0 1 0
    1 1 0 0 1 1
    

    输出样例:

    13
    11
    12

    #include<iostream>
    #include<string>
    #include<vector>
    #include<string>
    #include<cstdio>
    #include<cmath>
    #include<string.h>
    #include<algorithm>
    #include<unordered_map>
    #include<stack>
    #include<map>
    #include<regex>
    using namespace std;
    
    
    
    int main()
    {
        int n,m;
        scanf("%d%d",&n,&m);
        int weight[m];
        for(int i=0;i<m;i++)
            scanf("%d",&weight[i]);
        int ans[m];
        for(int i=0;i<m;i++)
            scanf("%d",&ans[i]);
        int res=0;
        for(int i=0;i<n;i++)
        {
            res=0;
            for(int j=0;j<m;j++)
            {
                int temp;
                scanf("%d",&temp);
                if(temp==ans[j])
                    res+=weight[j];
            }
            printf("%d
    ",res);
        }
        return 0;
    }
  • 相关阅读:
    硬盘安装FreeBSD 6.1release步骤
    Centos,bash: service: command not found
    test1tset
    ubuntu只能访问部份网站的处理方法
    lamp lnmp
    调查用QQ企业邮箱的smtp需要添加spf1
    asp.net文件下载
    FreeBSD更新ports源
    ubuntu 12.10 安装 fcitx 五笔
    csh/tcsh颜色配置
  • 原文地址:https://www.cnblogs.com/zhanghaijie/p/10409458.html
Copyright © 2020-2023  润新知