HDOJ 3412 An Odd Award Rule
来源:互联网 发布:银行it招聘 编辑:程序博客网 时间:2024/05/22 09:20
An Odd Award Rule
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 529 Accepted Submission(s): 192
Problem Description
The education of primary school in China is a big problem now. A teacher must be very careful not only when he/she is criticizing the students, but also when he/she is giving awards to good students. Teacher Liu always gave the top ten students on his examination some little awards before, but some parents are a little bit angry about this now. They say that their little kids may get hurt because they will never get the awards. Teacher Liu has to change his award rule. He wants all students have a chance to win the awards, no matter their scores are good or poor. But he still wants good students to get more chance. So the new rule seems a little bit odd: anyone whose score equals to the sum of the scores of OTHER 3 or 2 students, will win the award. Now figuring out who is qualified for the awards seems a little bit hard for Teacher Liu. As the monitor of his class and a little programmer, you should help him to do this.
Input
For each test case, first print an integer in a line, indicating how many students win the awards. Then print the names of those who win the awards in alphabetic order, each name in a line.
Output
For each test case, print one line containing an integer which equals to the formula’s value mod P.
Sample Input
15SIKE 12WORRY 20LUCENT 8KILI 3TOM 1
Sample Output
2SIKEWORRY
Source
2010 National Programming Invitational Contest Host by ZSTU
#include <iostream>#include <cstring>#include <cstdio>#include <set>#include <algorithm>#include <string>using namespace std;struct ST{ string str; int sorce;}S[1000];int n;bool vis[1000];string ret[1000];int main(){ int T; cin>>T;while(T--){ cin>>n; for(int i=0;i<n;i++) { cin>>S[i].str>>S[i].sorce; } memset(vis,0,sizeof(vis)); int ans=0; for(int i=0;i<n;i++) { for(int j=0;j<n;j++) { if(i==j) continue; for(int k=0;k<n;k++) { if(k==i||k==j) continue; if(S[k].sorce==S[i].sorce+S[j].sorce) { if(vis[k]==0) { ret[ans++]=S[k].str; vis[k]=1; } } } for(int k=0;k<n;k++) { if(k==i||k==j) continue; for(int l=0;l<n;l++) { if(l==i||l==j||l==k) continue; if(S[l].sorce==S[i].sorce+S[j].sorce+S[k].sorce) { if(vis[l]==0) { ret[ans++]=S[l].str; vis[l]=1; } } } } } } cout<<ans<<endl; sort(ret,ret+ans); for(int i=0;i<ans;i++) { cout<<ret[i]<<endl; }} return 0;}
0 0
- HDOJ 3412 An Odd Award Rule
- HDU 3412 杭州省赛 An Odd Award Rule
- poj 3778 hdu 3412 An Odd Award Rule
- HDU 3412 & poj 3778 An Odd Award Rule
- POJ 3778 An Odd Award Rule简单暴力
- non-zero winding number rule and the even-odd rule
- Sicily 12986. An Odd Sum
- HDOJ 5989 odd-even number
- uva 11617 An Odd Love (dp)
- 非零环绕数规则和奇-偶规则(Non-Zero Winding Number Rule&&Odd-even Rule)
- 非零环绕数规则和奇-偶规则(Non-Zero Winding Number Rule And Odd-even Rule)
- 非零环绕数规则和奇-偶规则(Non-Zero Winding Number Rule&&Odd-even Rule)
- hdoj An easy problem
- rule
- rule
- HDOJ 1076 An Easy Task
- HDOJ 1076 An Easy Task
- HDOJ-1076 An Easy Task
- vc中调用Com组件的方法详解
- Deep Learning(深度学习)
- lex yaac
- uboot参数表的结构和操作
- Android中的坐标及各种获取尺寸方法的含义
- HDOJ 3412 An Odd Award Rule
- 在android下怎么查看数据库.db文件
- Hibernate session.get()和session.load()方法的区别
- Windows Mobile 搭建OpenGL ES开发环境
- win8.1 华硕S300CA 触摸板 卡
- classpath变量的认识
- Solr 学习总结之配置文件内容
- 自动分组界面系统
- POJ1247:Magnificent Meatballs