2017-03-09 00:00:00小静 IBM认证
CCF,中国计算机学会,英文全称为China Computer Federation,简称CCF,成立于1962年,是中国计算机科学与技术领域群众性学术团体,属一级学会,独立法人单位,是中国科学技术协会的成员。下面是小编整理的关于ccf认证考试试题答案,欢迎大家参考!
1. 出现次数最多的数
import java.util.*;
public class Main {
public static void main(String[] args) {
new Main().run();
}
public void run() {
Scanner fin = new Scanner(System.in);
int N = fin.nextInt();
int[] count = new int[10001];
for (int i = 0; i < N; ++i) {
++count[fin.nextInt()];
}
int maxCount = -1;
int result = 0;
for (int i = 1; i <= 10000; ++i) {
if (count[i] > maxCount) {
maxCount = count[i];
result = i;
}
}
System.out.println(result);
}
}
2.ISBN号码
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
} public static void main(String args[]) { } BufferedReader bin = new BufferedReader(new InputStreamReader(System.in)); try{ } int sum=0;char cc='0'; String isbn_0 = bin.readLine(); String isbn = isbn_0.replace("-", ""); for(int i=0; i<9; i++){ } sum = sum % 11; if(sum == 10) cc = 'X';// else cc = (char)(sum+48); if(cc == isbn.charAt(9)) System.out.println("Right"); else{ } e.printStackTrace(); isbn_0 = isbn_0.substring(0,12) + cc; System.out.println(isbn_0); int ii = (int)isbn.charAt(i)-48; sum += ii * (i+1); }catch(Exception e){
3.最大的矩形
import java.util.*;
public class Main {
public static void main(String[] args) {
new Main().run();
}
public void run() {
Scanner fin = new Scanner(System.in);
int N = fin.nextInt();
int[] height = new int[N];
for (int i = 0; i < N; ++i) height[i] = fin.nextInt();
int result = 0;
for (int i = 0; i < N; ++i) {
int width = 1;
for (int j = i - 1; j >= 0; --j) {
if (height[j] < height[i]) break;
++width;
}
for (int j = i + 1; j < N; ++j) {
if (height[j] < height[i]) break;
++width;
}
int area = width * height[i];
result = Math.max(result, area);
}
System.out.println(result);
}
}
4.有趣的数
import java.util.*;
public class Main {
public static void main(String[] args) {
new Main().run();
}
public void run() {
Scanner fin = new Scanner(System.in);
863
人