点我:传送门 

程序员节快乐~

水水题

A

  1. import java.util.*;
  2. import java.io.*;
  3. public class Main
  4. {
  5. public static void main (String[] argv)
  6. {
  7. new Main();
  8. }
  9. boolean test = false;
  10. public Main(){
  11. FastReader in = new FastReader(new BufferedReader(new InputStreamReader(System.in)));
  12. //FastReader in = new FastReader(new BufferedReader(new FileReader("Main.in")));
  13. Scanner input = new Scanner(System.in);
  14. while(input.hasNext()){
  15. int n = input.nextInt();
  16. int k = input.nextInt();
  17. int countHurt = ;
  18. for(int i = ; i < n ; i ++) {
  19. double height = input.nextDouble();
  20. if(height > 1.8) {
  21. double hurt = (height-1.8)*(10.24);
  22. countHurt += (int)hurt;
  23. }
  24. }
  25. if(countHurt >= k) {
  26. System.out.println("YES");
  27. }else {
  28. System.out.println("NO");
  29. }
  30. }
  31. }
  32. static class FastReader
  33. {
  34. BufferedReader br;
  35. StringTokenizer st;
  36. public FastReader(BufferedReader in)
  37. {
  38. br = in;
  39. }
  40.  
  41. String next()
  42. {
  43. while (st == null || !st.hasMoreElements())
  44. {
  45. try
  46. {
  47. String line = br.readLine();
  48. if (line == null || line.length() == ) return "";
  49. st = new StringTokenizer(line);
  50. }
  51. catch (IOException e)
  52. {
  53. return "";
  54. //e.printStackTrace();
  55. }
  56. }
  57. return st.nextToken();
  58. }
  59. int nextInt()
  60. {
  61. return Integer.parseInt(next());
  62. }
  63.  
  64. long nextLong()
  65. {
  66. return Long.parseLong(next());
  67. }
  68.  
  69. double nextDouble()
  70. {
  71. return Double.parseDouble(next());
  72. }
  73.  
  74. String nextLine()
  75. {
  76. String str = "";
  77. try
  78. {
  79. str = br.readLine();
  80. }
  81. catch (IOException e)
  82. {
  83. return "";
  84. //e.printStackTrace();
  85. }
  86. return str;
  87. }
  88. }
  89. }

B

  1. import java.util.*;
  2. import java.io.*;
  3. public class Main
  4. {
  5. public static void main (String[] argv)
  6. {
  7. new Main();
  8. }
  9. boolean test = false;
  10. public Main(){
  11. FastReader in = new FastReader(new BufferedReader(new InputStreamReader(System.in)));
  12. //FastReader in = new FastReader(new BufferedReader(new FileReader("Main.in")));
  13. Scanner input = new Scanner(System.in);
  14. while(input.hasNext()) {
  15. int n = input.nextInt();
  16. String maxPowerMonkey = null;
  17. String minPowerMonkey = null;
  18. int maxPower = -;
  19. int minPower = ;
  20. while(n-->){
  21. String s = input.next();
  22. int power = input.nextInt();
  23. if(power > maxPower) {
  24. maxPower = power;
  25. minPowerMonkey = s;
  26. }
  27. if(power < minPower) {
  28. minPower = power;
  29. maxPowerMonkey= s;
  30. }
  31. }
  32. System.out.println(maxPowerMonkey + " "+ minPowerMonkey);
  33. }
  34.  
  35. }
  36. static class FastReader
  37. {
  38. BufferedReader br;
  39. StringTokenizer st;
  40. public FastReader(BufferedReader in)
  41. {
  42. br = in;
  43. }
  44.  
  45. String next()
  46. {
  47. while (st == null || !st.hasMoreElements())
  48. {
  49. try
  50. {
  51. String line = br.readLine();
  52. if (line == null || line.length() == ) return "";
  53. st = new StringTokenizer(line);
  54. }
  55. catch (IOException e)
  56. {
  57. return "";
  58. //e.printStackTrace();
  59. }
  60. }
  61. return st.nextToken();
  62. }
  63. int nextInt()
  64. {
  65. return Integer.parseInt(next());
  66. }
  67.  
  68. long nextLong()
  69. {
  70. return Long.parseLong(next());
  71. }
  72.  
  73. double nextDouble()
  74. {
  75. return Double.parseDouble(next());
  76. }
  77.  
  78. String nextLine()
  79. {
  80. String str = "";
  81. try
  82. {
  83. str = br.readLine();
  84. }
  85. catch (IOException e)
  86. {
  87. return "";
  88. //e.printStackTrace();
  89. }
  90. return str;
  91. }
  92. }
  93. }

C

  1. import java.util.*;
  2. import java.io.*;
  3. import java.math.BigDecimal;
  4. public class Main
  5. {
  6. public static void main (String[] argv)
  7. {
  8. new Main();
  9. }
  10. boolean test = false;
  11. public Main(){
  12. FastReader in = new FastReader(new BufferedReader(new InputStreamReader(System.in)));
  13. //FastReader in = new FastReader(new BufferedReader(new FileReader("Main.in")));
  14. Scanner input = new Scanner(System.in);
  15. while(input.hasNext()) {
  16. int inputnumber = input.nextInt();
  17. while(inputnumber-- >) {
  18. BigDecimal n = input.nextBigDecimal();
  19. System.out.println(n.multiply(new BigDecimal("")).setScale(,BigDecimal.ROUND_HALF_UP));
  20. }
  21. }
  22. }
  23. static class FastReader
  24. {
  25. BufferedReader br;
  26. StringTokenizer st;
  27. public FastReader(BufferedReader in)
  28. {
  29. br = in;
  30. }
  31.  
  32. String next()
  33. {
  34. while (st == null || !st.hasMoreElements())
  35. {
  36. try
  37. {
  38. String line = br.readLine();
  39. if (line == null || line.length() == ) return "";
  40. st = new StringTokenizer(line);
  41. }
  42. catch (IOException e)
  43. {
  44. return "";
  45. //e.printStackTrace();
  46. }
  47. }
  48. return st.nextToken();
  49. }
  50. int nextInt()
  51. {
  52. return Integer.parseInt(next());
  53. }
  54.  
  55. long nextLong()
  56. {
  57. return Long.parseLong(next());
  58. }
  59.  
  60. double nextDouble()
  61. {
  62. return Double.parseDouble(next());
  63. }
  64.  
  65. String nextLine()
  66. {
  67. String str = "";
  68. try
  69. {
  70. str = br.readLine();
  71. }
  72. catch (IOException e)
  73. {
  74. return "";
  75. //e.printStackTrace();
  76. }
  77. return str;
  78. }
  79. }
  80. }


思路:连续的0需要翻转2次,如果第1位是0,那么次数减去1。

  1. import java.util.*;
  2. import java.io.*;
  3. import java.math.BigDecimal;
  4. public class Main
  5. {
  6. public static void main (String[] argv)
  7. {
  8. new Main();
  9. }
  10. boolean test = false;
  11. public Main(){
  12. FastReader in = new FastReader(new BufferedReader(new InputStreamReader(System.in)));
  13. //FastReader in = new FastReader(new BufferedReader(new FileReader("Main.in")));
  14. Scanner input = new Scanner(System.in);
  15. while(input.hasNext()) {
  16. int inputnumber = input.nextInt();
  17. while(inputnumber-- >) {
  18. int cnt = ,flag = ,subflag = ;
  19. String s = input.next();
  20. for(int i = ; i < s.length(); i ++) {
  21. if(i == && s.charAt(i) == '') {
  22. subflag = ;
  23. }
  24. if(s.charAt(i)=='' && flag == ) {
  25. flag = ;
  26. cnt ++;
  27. }
  28. if(s.charAt(i) == '' && flag == ) {
  29. flag = ;
  30. }
  31. } System.out.println(cnt * - subflag);
  32. }
  33.  
  34. }
  35. }
  36. static class FastReader
  37. {
  38. BufferedReader br;
  39. StringTokenizer st;
  40. public FastReader(BufferedReader in)
  41. {
  42. br = in;
  43. }
  44.  
  45. String next()
  46. {
  47. while (st == null || !st.hasMoreElements())
  48. {
  49. try
  50. {
  51. String line = br.readLine();
  52. if (line == null || line.length() == ) return "";
  53. st = new StringTokenizer(line);
  54. }
  55. catch (IOException e)
  56. {
  57. return "";
  58. //e.printStackTrace();
  59. }
  60. }
  61. return st.nextToken();
  62. }
  63. int nextInt()
  64. {
  65. return Integer.parseInt(next());
  66. }
  67.  
  68. long nextLong()
  69. {
  70. return Long.parseLong(next());
  71. }
  72.  
  73. double nextDouble()
  74. {
  75. return Double.parseDouble(next());
  76. }
  77.  
  78. String nextLine()
  79. {
  80. String str = "";
  81. try
  82. {
  83. str = br.readLine();
  84. }
  85. catch (IOException e)
  86. {
  87. return "";
  88. //e.printStackTrace();
  89. }
  90. return str;
  91. }
  92. }
  93. }

E

  1. import java.util.*;
  2. import java.io.*;
  3. import java.math.BigDecimal;
  4. public class Main
  5. {
  6. int [] mapx = new int[];
  7. int [] mapy = new int[];
  8. public static void main (String[] argv)
  9. {
  10. new Main();
  11. }
  12. boolean test = false;
  13. public Main(){
  14. FastReader in = new FastReader(new BufferedReader(new InputStreamReader(System.in)));
  15. //FastReader in = new FastReader(new BufferedReader(new FileReader("Main.in")));
  16. int n = in.nextInt();
  17. int m = in.nextInt();
  18. for(int i = ; i <= n ; i ++) {
  19. for(int j = ; j <= m ; j++) {
  20. int number = in.nextInt();
  21. mapx[number] = i;
  22. mapy[number] = j;
  23. }
  24. }
  25. int q = in.nextInt();
  26. while(q-->) {
  27. int queryNumber = in.nextInt();
  28. System.out.println(mapx[queryNumber] + " "+mapy[queryNumber]);
  29. }
  30. }
  31. static class FastReader
  32. {
  33. BufferedReader br;
  34. StringTokenizer st;
  35. public FastReader(BufferedReader in)
  36. {
  37. br = in;
  38. }
  39.  
  40. String next()
  41. {
  42. while (st == null || !st.hasMoreElements())
  43. {
  44. try
  45. {
  46. String line = br.readLine();
  47. if (line == null || line.length() == ) return "";
  48. st = new StringTokenizer(line);
  49. }
  50. catch (IOException e)
  51. {
  52. return "";
  53. //e.printStackTrace();
  54. }
  55. }
  56. return st.nextToken();
  57. }
  58. int nextInt()
  59. {
  60. return Integer.parseInt(next());
  61. }
  62.  
  63. long nextLong()
  64. {
  65. return Long.parseLong(next());
  66. }
  67.  
  68. double nextDouble()
  69. {
  70. return Double.parseDouble(next());
  71. }
  72.  
  73. String nextLine()
  74. {
  75. String str = "";
  76. try
  77. {
  78. str = br.readLine();
  79. }
  80. catch (IOException e)
  81. {
  82. return "";
  83. //e.printStackTrace();
  84. }
  85. return str;
  86. }
  87. }
  88. }

1024程序员节!(JAVA Code)的更多相关文章

  1. 1024程序员节最新福利之2018最全H5前端资料集

    前言 有好久没有写博客了,主要这段时间都沉迷学习无法自拔了,哈哈.自吹一波. 前两天不是1024节吗,所以就有很多福利出现了,当然每个人能都获得的信息都有所不同,这就是所谓的信息差.秉着好东西需要分享 ...

  2. Java语言编码规范(Java Code Conventions)

    Java语言编码规范(Java Code Conventions) 名称 Java语言编码规范(Java Code Conventions) 译者 晨光(Morning) 简介 本文档讲述了Java语 ...

  3. java code to byte code--partone--reference

    Understanding how Java code is compiled into byte code and executed on a Java Virtual Machine (JVM) ...

  4. [转]Java Code Examples for android.util.JsonReader

    [转]Java Code Examples for android.util.JsonReader The following are top voted examples for showing h ...

  5. SQL to Java code for Elasticsearch

    Elasticsearch虽然定位为Search Engine,但是因其可以持久化数据,很多时候,我们把Elasticsearch当成Database用,但是Elasticsearch不支持SQL,就 ...

  6. JUnit单元测试教程(翻译自Java Code Geeks)

    JUnit单元测试教程--终极指南 JUnit单元测试教程终极指南 说明 单元测试简介 1 什么是单元测试 2 测试覆盖 3 Java中的单元测试 JUnit简介 1 使用Eclipse实现简单JUn ...

  7. Java Code Style

    近期困惑于团队成员代码风格迥异,代码质量不可控,作为一名老司机,忧患于后期服务的可维护性,多次一对一的代码Review,耗时耗力不说,效果也不明显.痛定思痛,多次反思之后得出结论:无规矩不成方圆,可靠 ...

  8. 玩转Eclipse — 自动代码生成的Java Code Template

    文章转载地址:点击打开链接 当代码写到一定程度之后,就会发现很多代码都被重复地敲了N多遍,甚至毫不夸张地说:闭着眼睛都能敲出来.大量地敲这些重复地代码,除了锻炼敲键盘的速度,基本上没有其他益处,但是长 ...

  9. Use formatter to format your JAVA code

    In order to make the codes looks unified and make it easy to understand, it's better to use the same ...

  10. 【Android XML】Android XML 转 Java Code 系列之 介绍(1)

    最近在公司做一个项目,需要把Android界面打包进jar包给客户使用.对绝大部分开发者来说,Android界面的布局以XML文件为主,并辅以少量Java代码进行动态调整.而打包进jar包的代码,意味 ...

随机推荐

  1. Objectarx之分批存储相连实体

    void CCommonFuntion::BatchStorageEnt(AcDbObjectIdArray& inputId, std::vector<std::vector<A ...

  2. pl/sql基础知识—pl/sql块介绍

    n  介绍 块(block)是pl/sql的基本成型单元,编写pl/sql程序实际上就是编写pl/sql块.要完成相对简单的应用功能,可能只需要编写一个pl/sql块:但是如果要想实现复杂的功能,可能 ...

  3. 如何利用 Webshell 诊断 EDAS Serverless 应用

    本文主要介绍 Serverless 应用的网络环境以及 Serverless 应用容器内的环境,了解背景知识以及基本的运维知识后可以利用 Webshell 完成基本的运维需求. Webshell 简介 ...

  4. Codeforces 432C

    题目链接 题意: 给出一个长度为n(n<=10^5)的数组a,  数组a是数字1到n的一种排列(打乱顺序). 每次可以选择两个数(不同)进行交换, 但是交换的条件是被选择的两个数的下标之差加1应 ...

  5. Android开发-API指南-<activity-alias>[原创译文]

    http://blog.sina.com.cn/s/blog_48d491300100zmg5.html

  6. Python学习之路9☞面向对象的程序设计

    一 面向对象的程序设计的由来 见概述:http://www.cnblogs.com/linhaifeng/articles/6428835.html 二 什么是面向对象的程序设计及为什么要有它 面向过 ...

  7. 【UML】之简单概括 标签: uml图形 2014-11-09 11:24 1130人阅读 评论(24) 收藏

    29号开始看UML的视频,由于之前看视频总是一拖拖上半个月,所以这次打算速战速决,而且UML视频的讲解和内容并不算多,也比较容易懂,到后期更是花了很多时间来举例子巩固各种图的画法,所以这次花了11天初 ...

  8. js错误处理Try-catch和throw

    1.try-catch语句   Try{ //可能会导致错误的代码 }catch(error){ //在错误发生时怎么处理 } 例如: try{ window.someNonexistentFunct ...

  9. ADO.NET sqlHelper类(DBHelper类)

    1.配置文件 <connectionStrings> <add name="constr" connectionString="Data Source= ...

  10. Java练习 SDUT-1132_斐波那契数列

    C/C++经典程序训练2---斐波那契数列 Time Limit: 1000 ms Memory Limit: 65536 KiB Problem Description 编写计算斐波那契(Fibon ...