HW7.3

public class Solution
{
public static void main(String[] args)
{
char[][] answers =
{
{'A', 'B', 'A', 'C', 'C', 'D', 'E', 'E', 'A', 'D'},
{'D', 'B', 'A', 'B', 'C', 'A', 'E', 'E', 'A', 'D'},
{'E', 'D', 'D', 'A', 'C', 'B', 'E', 'E', 'A', 'D'},
{'C', 'B', 'A', 'E', 'D', 'C', 'E', 'E', 'A', 'D'},
{'A', 'B', 'D', 'C', 'C', 'D', 'E', 'E', 'A', 'D'},
{'B', 'B', 'E', 'C', 'C', 'D', 'E', 'E', 'A', 'D'},
{'B', 'B', 'A', 'C', 'C', 'D', 'E', 'E', 'A', 'D'},
{'E', 'B', 'E', 'C', 'C', 'D', 'E', 'E', 'A', 'D'}
};
char[] keys = {'D', 'B', 'D', 'C', 'C', 'D', 'A', 'E', 'A', 'D'};
int[] students = new int[10];
int[] correctCount = new int[10];
int temp;
for(int i = 0; i < 10; i++)
students[i] = i;
for(int i = 0; i < answers.length; i++)
{
for(int j = 0; j < answers[i].length; j++)
if(answers[i][j] == keys[j])
correctCount[i]++;
}
for(int i = 0; i < 10; i++)
{
for(int j = i; j < 10; j++)
{
if(correctCount[j] > correctCount[i])
{
temp = correctCount[j];
correctCount[j] = correctCount[i];
correctCount[i] = temp;
temp = students[j];
students[j] = students[i];
students[i] = temp;
}
}
}
for(int i = 0; i < 10; i++)
System.out.println("Student " + students[i] + "'s correct count is " + correctCount[i]);
}
}
HW7.3的更多相关文章
- HW7.18
public class Solution { public static void main(String[] args) { int[][] m = {{1, 2}, {3, 4}, {5, 6} ...
- HW7.17
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...
- HW7.16
import java.util.Arrays; public class Solution { public static void main(String[] args) { int row = ...
- HW7.15
public class Solution { public static void main(String[] args) { double[][] set1 = {{1, 1}, {2, 2}, ...
- HW7.14
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...
- HW7.13
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...
- HW7.12
import java.util.Scanner; public class Solution { public static void main(String[] args) { double[] ...
- HW7.11
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...
- HW7.10
public class Solution { public static void main(String[] args) { int[][] array = new int[3][3]; for( ...
- HW7.9
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...
随机推荐
- VS2005中SetUnhandledExceptionFilter函数应用
很多软件通过设置自己的异常捕获函数,捕获未处理的异常,生成报告或者日志(例如生成mini-dump文件),达到Release版本下追踪Bug的目的.但是,到了VS2005(即VC8),Microsof ...
- AC题目简解-数据结构
A - Japan POJ 3067 要两条路有交叉,(x1,y1)(x2,y2)那么需要满足:(x1-x2)*(y1-y2)<0判断出这是求逆序的问题 树状数组求逆序,先通过自定义的比较器实 ...
- cache设计,以及多核造成的不一致性以及解决方案
http://www.360doc.com/content/11/1013/00/1317564_155625188.shtml http://blog.csdn.net/muxiqingyang/a ...
- R语言中的箱图介绍 boxplot
画箱图的函数: boxplot()##help(boxplot)查询具体用法 图例的解释: 如下图,是两个简单的箱图. 中间的箱子的上下边,分别是第三,一个四分位数. 中间的黑线是第二四分位数(中 ...
- 函数(Functions)
概念: 下面是蛮经典的解释: What Good are Functions? You might have considered the situation where you would li ...
- CentOS5.5上安装git
1.尝试用yum安装git失败 [root@localhost usr]# yum install gitLoaded plugins: fastestmirrorLoading mirror spe ...
- Codeforces 364A - Matrix
原题地址:http://codeforces.com/problemset/problem/364/A 题目大意: 给定一个数字a(0 ≤ a ≤ 109)和一个数列s(每个数都是一位,长度不超过40 ...
- 函数buf_LRU_search_and_free_block
/******************************************************************//** Try to free a replaceable bl ...
- 反编译.net dll
自己公司的程序,年代久了,没有源代码,修改一些小地方,只能反编译,还好当时没有混淆. 先ildasm 反编译. 删除 .publickey = ( ) 这段,去原来签名. 然后再用找要改的IL,这 ...
- asp.net(vs2005) + Sql2000 缓存依赖
1.开启数据库缓存依赖支持 开始,运行,cmd 输入 C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regsql -S localhost ...