ccf试题及答案java,ccf认证考试试题答案

ccf认证考试试题答案

CCF,中国计算机学会,英文全称为China Computer Federation,简称CCF,成立于1962年,是中国计算机科学与技术领域群众性学术团体,属一级学会,独立法人单位,是中国科学技术协会的成员。下面是小编整理的关于ccf认证考试试题答案,欢迎大家参考!

e02f51a3c6fad1fba2ce95bc8ace715d.png

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);

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值