当前位置:网站首页>PAT B1061
PAT B1061
2022-06-25 19:55:00 【Madness makes freedom】
1061 Judgment questions (15 branch )
It's easy to judge a question , This question asks you to write a simple program to help the teacher judge the question and count the scores of the students .
Input format :
Enter two or less on the first line 100 The positive integer N and M, They are the number of students and the number of judgment questions . The second line gives M No more than one. 5 The positive integer , It's the full score of each question . The third line gives the correct answer to each question ,0 representative “ Not ”,1 representative “ yes ”. And then N That's ok , Each line gives a student's answer . Numbers are separated by spaces .
Output format :
Output the scores of each student in the order of input , One line per score .
sample input :
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
sample output :
13
11
12#include <iostream>
using namespace std;
int main()
{
int n,m;
cin >> n >> m;
int full_grade[m],right[m],stu_answer[m],stu_grade[n];
for(int i=0;i<m;i++)
cin >> full_grade[i];
for(int i=0;i<m;i++)
cin >> right[i];
int j=0;
while(n--)
{
int grade=0;
for(int i=0;i<m;i++)
{
cin >> stu_answer[i];
if(stu_answer[i]==right[i])
grade+=full_grade[i];
}
stu_grade[j++]=grade;
}
for(int i=0;i<j;i++)
{
cout << stu_grade[i] << endl;
}
return 0;
}边栏推荐
- LNMP compilation and installation
- Ali visual AI training camp -day03- construction of electronic photo album (face and expression recognition)
- Network security detection and prevention test questions (4)
- 2、 Hikaricp source code analysis of connection acquisition process II
- Mysql database design suggestions
- Read multiple associations from a field using delimiters in laravel
- Number of wechat applet custom input boxes
- Record Baidu search optimization thinking analysis
- Arduino : No such file or directory
- Randomly generate 100 non repeating numbers between 1 and 150 and put them in the array
猜你喜欢

Ali visual AI training camp -day03- construction of electronic photo album (face and expression recognition)

Guangzhou Sinovel interactive creates VR Exhibition Hall panoramic online virtual exhibition hall

Google SEO external chain releases 50+ website platform sharing (e6zzseo)

Ali visual AI training camp -day05- creativity day - your image recognition project

Jsonp processing non homologous

PostgreSQL user role permissions

Vulnhub range - correlation:2

On Oracle full stack virtual machine -- graalvm

JS asynchronism (I. asynchronous concept, basic use of web worker)

Web container basic configuration
随机推荐
Native JS array some method de duplication
Is it safe to open a new bond? Is low commission reliable
1、 Hikaricp source code analysis of connection acquisition process I
Lilda Bluetooth air conditioning receiver helps create a more comfortable road life
Ali visual AI training camp -day05- creativity day - your image recognition project
Pdf file download (the download name is the same as the file name)
Trend ea- fixed stop loss and profit per order
Applet Click to return to the top 2 methods
DARKHOLE 2
Applet wx Request encapsulation
Cutting feet to fit shoes - talking about the ramp reconstruction on the track
Tcp/ip test questions (4)
Is CICC wealth safe? How long does it take to open an account
Apifox simple understanding -- the integrator of web side testing
Android Development Notes - Quick Start (from sqllite to room licentiousness) 2
Hdoj topic 2005 day
Electronic package to generate EXE file
Laravel validation rule followed Role of auth:: id()
Tcp/ip test questions (V)
Wechat applet connects to the server to display mqtt data information