Roll-call in Woop Woop High

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 188    Accepted Submission(s): 133

Problem 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 (1 <= K <= 100) indicating the
number of classes. Each class starts with an integer N (1 <= N <=
50) 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
 
Source
 

//输出的一共5行,第一行略微有点坑,第一行其实就是指的第几组数据,大概就是case的意思

Recommend
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
using namespace std; struct pp{
char m[];
int flag1;
int cro,wro,sum;
}a[]; int main()
{
int t;
scanf("%d",&t);
int ans1 = ;
while(t--)
{
int n;
scanf("%d",&n);
getchar();
int max1 = ;
for(int i = ;i < n;i++)
{
gets(a[i].m);
int len = strlen(a[i].m);
int flag = -;
int j = ;
a[i].cro = ;
a[i].wro = ;
a[i].sum = ;
for( ;j < len;j++)
{
if(a[i].m[j] == ' ')
break;
}
j++;
for( ;j < len;j++)
{
if(a[i].m[j] == 'y')
{
flag = ;
a[i].cro++;
if(a[i].m[j+] == 'e')
j = j+;
else
j++;
break;
}
else if(a[i].m[j] == 'n')
{
flag = ;
a[i].wro++;
if(a[i].m[j+] == 'o')
j = j+;
else
j++;
break;
}
} a[i].flag1 = flag;
j++;
for( ;j < len;j++)
{
if(a[i].m[j] == 'y')
{
a[i].cro++;
if(a[i].m[j+] == 'e')
j = j+;
else
j++;
}
else if(a[i].m[j] == 'n')
{
a[i].wro++;
if(a[i].m[j+] == 'o')
j = j+;
else
j++;
}
}
a[i].sum = a[i].cro + a[i].wro;
if(max1 < a[i].sum)
max1 = a[i].sum;
} // for(int i = 0;i < n;i++)
// printf("---%s %d %d %d\n",a[i].m,a[i].cro,a[i].wro,a[i].sum); int ans2 = ,ans3 = ,ans4 = ,ans5 = ;
for(int i = ;i < n;i++)
{
if(a[i].wro == && a[i].cro > )
ans2++;
if(a[i].flag1 == && a[i].cro > )
ans3++;
if(a[i].wro >= )
ans4++;
if(a[i].sum == )
ans5++;
}
printf("Roll-call: %d\n",++ans1);
printf("Present: %d out of %d\n",ans2,n);
printf("Needs to study at home: %d out of %d\n",ans3,n);
printf("Needs remedial work after school: %d out of %d\n",ans4,n);
printf("Absent: %d out of %d\n",ans5,n);
}
return ;
}

HDU 4178 模拟的更多相关文章

  1. hdu 4891 模拟水题

    http://acm.hdu.edu.cn/showproblem.php?pid=4891 给出一个文本,问说有多少种理解方式. 1. $$中间的,(s1+1) * (s2+1) * ...*(sn ...

  2. hdu 5012 模拟+bfs

    http://acm.hdu.edu.cn/showproblem.php?pid=5012 模拟出骰子四种反转方式,bfs,最多不会走超过6步 #include <cstdio> #in ...

  3. hdu 4669 模拟

    思路: 主要就是模拟这些操作,用链表果断超时.改用堆栈模拟就过了 #include<map> #include<set> #include<stack> #incl ...

  4. 2013杭州网络赛C题HDU 4640(模拟)

    The Donkey of Gui Zhou Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/O ...

  5. HDU/5499/模拟

    题目链接 模拟题,直接看代码. £:分数的计算方法,要用double; #include <set> #include <map> #include <cmath> ...

  6. hdu 5003 模拟水题

    http://acm.hdu.edu.cn/showproblem.php?pid=5003 记得排序后输出 #include <cstdio> #include <cstring& ...

  7. hdu 5033 模拟+单调优化

    http://acm.hdu.edu.cn/showproblem.php?pid=5033 平面上有n个建筑,每个建筑由(xi,hi)表示,m组询问在某一个点能看到天空的视角范围大小. 维护一个凸包 ...

  8. HDU 2860 (模拟+并查集)

    Regroup Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Sub ...

  9. hdu 5083(模拟)

    Instruction Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total ...

随机推荐

  1. java Vamei快速教程09 类数据和类方法

    作者:Vamei 出处:http://www.cnblogs.com/vamei 欢迎转载,也请保留这段声明.谢谢! 我们一直是为了产生对象而定义类(class)的.对象是具有功能的实体,而类是对象的 ...

  2. js 中//<![CDATA[ 意义

    CDATA内部所有东西都会被解析器忽略,加入文本中包含了大量< 和 $符号,就像编程中经常出现的情况一样,那么这个元素就可以被定义为一个CDATA部分 ,CDATA 区段开始于 "&l ...

  3. IOS NSBundle使用(访问文件夹)

    NSBundle的相关信息 1.一个NSBundle代表一个文件夹,利用NSBundle能访问对应的文件夹 2.利用mainBundle就可以访问软件资源包中的任何资源 3.模拟器应用程序的安装路径: ...

  4. World Wind Java开发之三 显示状态栏信息(转)

    http://blog.csdn.net/giser_whu/article/details/40920315 先来看下本篇博客索要达到的效果: 找到源码下的gov.nasa.worldwind.ut ...

  5. codeforces 600D Area of Two Circles' Intersection

    分相离,内含,想交三种情况讨论一下. 主要是精度和数据范围的问题,首先数据用long double,能用整型判断就不要用浮点型. 题目中所给的坐标,半径是整型的,出现卡浮点判断的情况还是比较少的. 最 ...

  6. UVA Live Achrive 4327 Parade (单调队列,dp)

    容易想到dp[i][j]表示在第i行j个路口的开始走最大高兴值. 每次可以向左走,或者向右边走,然后向北走.(或者直接往北) 向左走到,状态转移为dp[i][j] = dp[i][k] + happy ...

  7. python_78_软件目录结构规范

    一定要看http://www.cnblogs.com/alex3714/articles/5765046.html #print(__file__)#打印的是文件的相对路径 import os pri ...

  8. Hadoop集群批量命令执行

    ./pdsh -R ssh -w node-10-0[0-5] hostname -R:指定传输方式,默认为rsh,本例为ssh,如果希望ssh传输需要另行安装pdsh-rcmd-ssh,如果希望ss ...

  9. Oracle Hint 之 Append

    1 描述 所谓直接路径操作,就是绕过buffer cache,直接将数据插入到表所在的数据文件中: 假如有表A,要将A中的数据插入到表B,在普通的间接插入下,先将A中的数据块传进buffer cach ...

  10. java算法面试题:递归算法题1

    递归算法题1 一个整数,大于0,不用循环和本地变量,按照n,2n,4n,8n的顺序递增,当值大于5000时,把值按照指定顺序输出来.例:n=1237则输出为:1237,2474,4948,9896,9 ...