下载此文档

CCF部分真题代码(Java)分析报告.doc


文档分类:IT计算机 | 页数:约16页 举报非法文档有奖
1/16
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/16 下载此文档
文档列表 文档介绍
2013-12-1 // 出现次数最多的数 package demo; import .*; public class Test2{ public static void main(String[] args ){ new Test2().run(); } public void run(){ System. out .println( " 请输入: " ); ***@SuppressWarnings ( "resource" ) 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 ); }} 2014-03-01 // 相反数 package demo; import .*; public class Test3 { public static void main(String[] args ){ new Test3().run(); } public void run() { ***@SuppressWarnings ( "resource" ) // 输入一个正整数 1~500 Scanner input = new Scanner(System. in ); System. out .println( " 请输入一个 1~500 的整数:" ); int N= input .nextInt(); int [] value = new int [N ]; int count = 0; System. out .println( " 请输入"+N+" 个正整数,且每个数绝对值不超过 1000 , 不同的数" ); // 加入数组 for ( int i= 0; i<N; ++ i){ value [i]= input .nextInt(); } // 双层循环查找 for ( int i= 0; i<N;i ++) { for ( int j=i+ 1; j<N;j ++) { if ( value [i] == (- value [j ])) { count ++; }}} System. out .println( count ); }} 201309-3 // 字符串匹配 package demo; import ; public class Test4 { public static void main(String[] args ){ ***@SuppressWarnings ( "resource" ) Scanner reader = new Scanner(System. in ); String str = reader .next(); int p= reader .nextInt(); int n= reader .nextInt(); int d= 0; String[] re = new String[ n ]; for ( int t= 0; t<n;t ++) { String s= reader .next(); if (p == 0) {s=s .toLowerCase(); str = str .toLowerCase(); } if (s .contains( str )) { re [d]=s;d=d+ 1; }} for ( int i= 0; i<d;i ++) System. out .println( re [i ]); }} 2014-09-1 // 相邻数对 package demo; import .*; public class Test5 { public static void main(String[] args ){ new Test5().run(); } public void run() { // 输入 System. out .println( " 请输入" ); ***@SuppressWarnings ( "resource" ) Scanner input = new Scanner(System. in ); i

CCF部分真题代码(Java)分析报告 来自淘豆网m.daumloan.com转载请标明出处.

相关文档 更多>>
非法内容举报中心
文档信息
  • 页数16
  • 收藏数0 收藏
  • 顶次数0
  • 上传人s0012230
  • 文件大小202 KB
  • 时间2017-05-16
最近更新