C - Roll-call in Woop Woop High

Description

The new principal of Woop Woop High is not satisfied with her pupils performance. She introduced a new roll-call process to get a daily measure of the pupils‘ learning, which proceeds as follows:

At the beginning of the daily roll-call period each pupil is handed a question, which they must attempt to answer, before proceeding to their classes. A pupil stops after the question is answered correctly. Each pupil is allowed up to five attempts to answer the question correctly.

Pupils who answer correctly on the first attempt are marked present. Pupils who answer correctly after more than one attempt are encouraged to work at home. Pupils who fail to develop a correct answer within five attempts are given remedial classes after school. Pupils who do not give any answer are marked as abscent.

Your task is to write a program that reads the pupils‘ assessments and generates performance reports for the principal to proceed with appropriate actions.

Input

The input starts with an integer K ( 1K100) indicating the number of classes. Each class starts with an integer N ( 1N50) indicating the number of pupils in the class. Each of the following N lines starts with a pupil‘s name followed by up-to five assessments of his/her answers. An assessment of ‘yes‘ or ‘y‘ indicates a correct answer and an assessment of ‘n‘ or ‘no‘ indicates a wrong answer. A pupil‘s name consists of a single string with no white spaces.

Output

The attendance report for each class consists of five lines.

  • The first line consists of the sentence: "Roll-call: X", where X indicates the class number starting with the value of one.
  • The second line consists of the sentence: ‘‘Present: Y1 out of N‘‘, where Y1 is the number of pupils who did not submit a wrong answer.
  • The third line consists of the sentence: ‘‘Needs to study at home: Y2 out of N‘‘, where Y2 is the number of pupils who submitted a number of wrong answers before submitting the correct answer.
  • The fourth line consists of the sentence: ‘‘Needs remedial work after school: Y3 out of N‘‘, where Y3 indicates the number of pupils whose submitted five wrong answers.
  • The fifth line consists of the sentence: ‘‘Absent: Y4 out of N‘‘, where Y4 indicates the number of absent pupils.

Sample Input

2
5
Doc n y
sneezy n n no yes
princecharming no n no no n
goofy yes
grumpy n y
5
evilemperor n y
princesslia
r2d2 no no y
obeyonecanopy n no y
darthvedar y

Sample Output

Roll-call: 1
Present: 1 out of 5
Needs to study at home: 3 out of 5
Needs remedial work after school: 1 out of 5
Absent: 0 out of 5
Roll-call: 2
Present: 1 out of 5
Needs to study at home: 3 out of 5
Needs remedial work after school: 0 out of 5
Absent: 1 out of 5
/*
题意:每个人做五道题  答对(yes/y) 答错(n,/n)
      Roll-call: 1   回合
      Present: 1 out of 5   第一道就答对了
      Needs to study at home: 3 out of 5  五道题之内答对了一道  但不是第一道
      Needs remedial work after school: 1 out of 5  五道题都没有答对
      Absent: 0 out of 5   一道题也没有回答

 各种写法都有   不过就还是最熟悉的写法来的好
 读空格 gets()  也可以是读整行的getline--cin.getline(str,100);
 getcahr()  一直不能掌握其要领  不过输入字符串的时候就要注意一下
 */

 #include <iostream>
 #include <string.h>
 #include <stdio.h>

 using namespace std;
 int s1,s2,s3,s4;
 bool OK;
 int cnt;

 int main()
 {
     int t,n;
     int num;
     char str[150];

     scanf("%d",&t);
     for(num=1;num<=t;num++)
     {
         s1=0;s2=0;s3=0;s4=0;

         scanf("%d",&n);
         int s=n;
         getchar();
         while(n--)
         {
              OK=false;
              cnt=0;
              gets(str);
              int len=strlen(str);
              for(int i=0;i<len;i++)
              {
                  if(str[i-1]==‘ ‘&&str[i]==‘y‘)
                  {
                      if(cnt==0)  ///yi ci jiu dui
                      s1++;
                      else  ///hui da hao ji ci dui
                      s2++;
                      cnt++;   ///lai guo
                      OK=true;
                  }
                  else if(str[i-1]==‘ ‘&&str[i]==‘n‘)
                  {
                      cnt++;  ///lai guo
                  }

              }
              if(cnt==0)
              s4++;   ///mei lai
              else if(!OK)
              s3++;  ///mei dui guo
         }
        // cout<<s1<<‘ ‘<<s2<<‘ ‘<<s3<<‘ ‘<<s4<<endl;
        printf("Roll-call: %d\n",num);
        printf("Present: %d out of %d\n",s1,s);
        printf("Needs to study at home: %d out of %d\n",s2,s);
        printf("Needs remedial work after school: %d out of %d\n",s3,s);
        printf("Absent: %d out of %d\n",s4,s);
     }
 }

C - Roll-call in Woop Woop High

时间: 2024-10-08 11:35:42

C - Roll-call in Woop Woop High的相关文章

A - Class Statistics

Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu Submit Status Practice UVALive 5682 Description ///最开始 没有读懂 Largest gap坑也~~~ 是拍好循序后的 连续最大差 #include <iostream> #include <string.h> #include <stdio.h> #include <

理解传说中的roll、yaw、pitch

三维中 Yaw, pitch and roll 的区分(图片)                    yaw 航偏                                         pitch倾斜/俯仰                             roll横滚 假定Z轴正方向为前进方向,则有下面的示意图来解释这三个角元素的意义: yaw():航向,将物体绕Y轴旋转(localRotationY) pitch():俯仰,将物体绕X轴旋转(localRotationX) r

HDOJ题目3309 Roll The Cube(BFS)

Roll The Cube Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 502    Accepted Submission(s): 181 Problem Description This is a simple game.The goal of the game is to roll two balls to two holes

HDU3309:Roll The Cube(BFS)

Problem Description This is a simple game.The goal of the game is to roll two balls to two holes each. 'B' -- ball 'H' -- hole '.' -- land '*' -- wall Remember when a ball rolls into a hole, they(the ball and the hole) disappeared, that is , 'H' + 'B

pitch, raw 以及roll三者的关系

三维笛卡尔坐标: pitch是围绕X轴旋转,也叫做俯仰角: yaw是围绕Y轴旋转,也叫偏航角: roll是围绕Z轴旋转,也叫翻滚角:

pip install报错Can&#39;t roll back cryptography; was not uninstalled

当使用pip install或者pip install --upgrade报错 Can't roll back cryptography; was not uninstalled 可以进行以下的尝试: sudo apt-get install libssl-dev libffi-dev 之后再继续php install pip install报错Can't roll back cryptography; was not uninstalled

uva 1017 - Merrily, We Roll Along!(几何线性轮廓)

题目链接:uva 1017 - Merrily, We Roll Along! 将所有点依次连接起来形成一条曲线,圆心移动的轨迹其实就是一条时刻与它距离为r的曲线. 对于线段就是平移,对于点就是一个圆.要求的轨迹其实就是所有线段和圆的轮廓,所以从起始位置开始,每次暴力出下一要移动到的点,距离就是最终的和. 对于从圆上的点A移动到线段或是圆上的点B,角AOB(O为圆心)要尽量小. 对于从线段上的点A移动到线段或是圆上的点B,AB的距离要尽量小. #include <cstdio> #includ

HDU 3150 Robot Roll Call – Cambot…Servo…Gypsy…Croooow(map)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3150 Problem Description Mystery Science Theater 3000 is about to start, which means it's time for "Robot Roll Call", where the name of each robot is called out, as per the list received from Earth.

HNU 11979 Roll call 二分图匹配

题意: 众所周知,老师经常在班级上点名.点名是从名单上叫一个人的名字或者id来判断名单上这个人是否在场.学生们总是有各种各样的理由不来,所以他们需要其他人帮他们答到.但是打到工作不是这么简单,出于各种考虑,他们答道遵循以下原则. 1. 每个来上课的人必须给自己达到: 2. 每个来上课的人,只能帮另外一个人达到: 3. 如果一个人想帮助另外一个人答道,那么他们id的差至少大于等于K. 现在老师又要点名了,请问是否存在一种情况,使老师相信每个人都到场了. 输入: 第一行有一个整数T,表示接下来会有T