当前位置:网站首页>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;
}边栏推荐
- Applet password input box
- Some pictures of real machine preview development and debugging are not shown
- What are Baidu collection skills? 2022 Baidu article collection skills
- Tcp/ip test questions (II)
- Wechat applet connects to the server to display mqtt data information
- ECS 7-day practical training camp (Advanced route) -- day03 -- ecs+slb load balancing practice
- Applet Click to return to the top 2 methods
- PHP database connection version1.1
- 五、HikariCP源码分析之初始化分析二
- Print 1 cute every 100 milliseconds ~ with a running lantern effect
猜你喜欢

Yaml configuration

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

Genicam gentl standard ver1.5 (1)

Vulnhub range - the planes:venus

Wechat applet cloud function does not have dependency option installed

One night I worked as an XPath Terminator: XPath Helper Plus

Applet multi image to Base64 upload

Miner's Diary: why should I go mining on April 5, 2021

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

Laravel validation rule followed Role of auth:: id()
随机推荐
Alicloud centos8.0 installing mysql8
Jump jump games auxiliary (manual version) py code implementation
在打新债开户证券安全吗
3、 Hikaricp source code analysis of connection acquisition process III
Applet request interface encapsulation
Force wechat page font size to be 100%
Apifox simple understanding -- the integrator of web side testing
Can GoogleSEO only do content without external chain? (e6zzseo)
JQ implements tab switching
JS advanced
MySQL view explanation
Uniapp waterfall flow, applet waterfall flow, very simple, suitable for the whole platform
Ali visual AI training camp -day05- creativity day - your image recognition project
Tcp/ip test questions (III)
一、HikariCP获取连接流程源码分析一
Wechat applet swiper simple local picture display appears large blank
Vulnhub range the planes: mercury
Gbpnzd firm offer for 14 months, simulation for 19 months, test stable
2、 Hikaricp source code analysis of connection acquisition process II
Suddenly found that the screen adjustment button can not be used and the brightness can not be adjusted