当前位置:网站首页>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;
}边栏推荐
- PostgreSQL change table owner
- Number of wechat applet custom input boxes
- Alicloud centos8.0 installing mysql8
- Solidity contract address to wallet, wallet address to contract
- Vscode debugging PHP configuration Xdebug
- Idea common plug-ins
- 五、HikariCP源码分析之初始化分析二
- rmi-registry-bind-deserialization
- JS asynchronism (III. usage of generator and async/await)
- Hdoj topic 2005 day
猜你喜欢

Uncover ges super large scale graph computing engine hyg: Graph Segmentation

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

Applet password input box

Process of vacuum and vacuum full

Ali vision AI training camp-day01

Using flex to implement the Holy Grail layout is as simple as that

Vulnhub range the planes:earth

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

Wechat applet swiper simple local picture display appears large blank

Connecting PHP to MySQL instances in the lamp environment of alicloud's liunx system
随机推荐
Panda weekly -2022/02/18
QQ robot flash forwarding / recall message forwarding [latest beta2 version]
What should I pay attention to in GoogleSEO content station optimization?
Web container basic configuration
PHP Chinese regular
Yaml configuration
MySQL transaction explanation
Processing method for uniapp or applet onload not receiving parameters
Applet request interface encapsulation
Determine whether it is a web page opened on wechat
Read multiple associations from a field using delimiters in laravel
The native JS mobile phone sends SMS cases. After clicking the button, the mobile phone number verification code is sent. The button needs to be disabled and re enabled after 60 seconds
Automatic fitting when the applet reaches the top
Can GoogleSEO only do content without external chain? (e6zzseo)
Tcp/ip test questions (I)
Jsonp non homologous interaction (click trigger)
Bloom filter
Applet wx Request encapsulation
Vulnhub range - darkhole 1
Please do not call Page constructor in files