1024程序员节!(JAVA Code)
点我:传送门
程序员节快乐~
水水题
A
import java.util.*;
import java.io.*;
public class Main
{
public static void main (String[] argv)
{
new Main();
}
boolean test = false;
public Main(){
FastReader in = new FastReader(new BufferedReader(new InputStreamReader(System.in)));
//FastReader in = new FastReader(new BufferedReader(new FileReader("Main.in")));
Scanner input = new Scanner(System.in);
while(input.hasNext()){
int n = input.nextInt();
int k = input.nextInt();
int countHurt = ;
for(int i = ; i < n ; i ++) {
double height = input.nextDouble();
if(height > 1.8) {
double hurt = (height-1.8)*(10.24);
countHurt += (int)hurt;
}
}
if(countHurt >= k) {
System.out.println("YES");
}else {
System.out.println("NO");
}
}
}
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader(BufferedReader in)
{
br = in;
} String next()
{
while (st == null || !st.hasMoreElements())
{
try
{
String line = br.readLine();
if (line == null || line.length() == ) return "";
st = new StringTokenizer(line);
}
catch (IOException e)
{
return "";
//e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt()
{
return Integer.parseInt(next());
} long nextLong()
{
return Long.parseLong(next());
} double nextDouble()
{
return Double.parseDouble(next());
} String nextLine()
{
String str = "";
try
{
str = br.readLine();
}
catch (IOException e)
{
return "";
//e.printStackTrace();
}
return str;
}
}
}
B
import java.util.*;
import java.io.*;
public class Main
{
public static void main (String[] argv)
{
new Main();
}
boolean test = false;
public Main(){
FastReader in = new FastReader(new BufferedReader(new InputStreamReader(System.in)));
//FastReader in = new FastReader(new BufferedReader(new FileReader("Main.in")));
Scanner input = new Scanner(System.in);
while(input.hasNext()) {
int n = input.nextInt();
String maxPowerMonkey = null;
String minPowerMonkey = null;
int maxPower = -;
int minPower = ;
while(n-->){
String s = input.next();
int power = input.nextInt();
if(power > maxPower) {
maxPower = power;
minPowerMonkey = s;
}
if(power < minPower) {
minPower = power;
maxPowerMonkey= s;
}
}
System.out.println(maxPowerMonkey + " "+ minPowerMonkey);
} }
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader(BufferedReader in)
{
br = in;
} String next()
{
while (st == null || !st.hasMoreElements())
{
try
{
String line = br.readLine();
if (line == null || line.length() == ) return "";
st = new StringTokenizer(line);
}
catch (IOException e)
{
return "";
//e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt()
{
return Integer.parseInt(next());
} long nextLong()
{
return Long.parseLong(next());
} double nextDouble()
{
return Double.parseDouble(next());
} String nextLine()
{
String str = "";
try
{
str = br.readLine();
}
catch (IOException e)
{
return "";
//e.printStackTrace();
}
return str;
}
}
}
C
import java.util.*;
import java.io.*;
import java.math.BigDecimal;
public class Main
{
public static void main (String[] argv)
{
new Main();
}
boolean test = false;
public Main(){
FastReader in = new FastReader(new BufferedReader(new InputStreamReader(System.in)));
//FastReader in = new FastReader(new BufferedReader(new FileReader("Main.in")));
Scanner input = new Scanner(System.in);
while(input.hasNext()) {
int inputnumber = input.nextInt();
while(inputnumber-- >) {
BigDecimal n = input.nextBigDecimal();
System.out.println(n.multiply(new BigDecimal("")).setScale(,BigDecimal.ROUND_HALF_UP));
}
}
}
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader(BufferedReader in)
{
br = in;
} String next()
{
while (st == null || !st.hasMoreElements())
{
try
{
String line = br.readLine();
if (line == null || line.length() == ) return "";
st = new StringTokenizer(line);
}
catch (IOException e)
{
return "";
//e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt()
{
return Integer.parseInt(next());
} long nextLong()
{
return Long.parseLong(next());
} double nextDouble()
{
return Double.parseDouble(next());
} String nextLine()
{
String str = "";
try
{
str = br.readLine();
}
catch (IOException e)
{
return "";
//e.printStackTrace();
}
return str;
}
}
}
D
思路:连续的0需要翻转2次,如果第1位是0,那么次数减去1。
import java.util.*;
import java.io.*;
import java.math.BigDecimal;
public class Main
{
public static void main (String[] argv)
{
new Main();
}
boolean test = false;
public Main(){
FastReader in = new FastReader(new BufferedReader(new InputStreamReader(System.in)));
//FastReader in = new FastReader(new BufferedReader(new FileReader("Main.in")));
Scanner input = new Scanner(System.in);
while(input.hasNext()) {
int inputnumber = input.nextInt();
while(inputnumber-- >) {
int cnt = ,flag = ,subflag = ;
String s = input.next();
for(int i = ; i < s.length(); i ++) {
if(i == && s.charAt(i) == '') {
subflag = ;
}
if(s.charAt(i)=='' && flag == ) {
flag = ;
cnt ++;
}
if(s.charAt(i) == '' && flag == ) {
flag = ;
}
} System.out.println(cnt * - subflag);
} }
}
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader(BufferedReader in)
{
br = in;
} String next()
{
while (st == null || !st.hasMoreElements())
{
try
{
String line = br.readLine();
if (line == null || line.length() == ) return "";
st = new StringTokenizer(line);
}
catch (IOException e)
{
return "";
//e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt()
{
return Integer.parseInt(next());
} long nextLong()
{
return Long.parseLong(next());
} double nextDouble()
{
return Double.parseDouble(next());
} String nextLine()
{
String str = "";
try
{
str = br.readLine();
}
catch (IOException e)
{
return "";
//e.printStackTrace();
}
return str;
}
}
}
E
import java.util.*;
import java.io.*;
import java.math.BigDecimal;
public class Main
{
int [] mapx = new int[];
int [] mapy = new int[];
public static void main (String[] argv)
{
new Main();
}
boolean test = false;
public Main(){
FastReader in = new FastReader(new BufferedReader(new InputStreamReader(System.in)));
//FastReader in = new FastReader(new BufferedReader(new FileReader("Main.in")));
int n = in.nextInt();
int m = in.nextInt();
for(int i = ; i <= n ; i ++) {
for(int j = ; j <= m ; j++) {
int number = in.nextInt();
mapx[number] = i;
mapy[number] = j;
}
}
int q = in.nextInt();
while(q-->) {
int queryNumber = in.nextInt();
System.out.println(mapx[queryNumber] + " "+mapy[queryNumber]);
}
}
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader(BufferedReader in)
{
br = in;
} String next()
{
while (st == null || !st.hasMoreElements())
{
try
{
String line = br.readLine();
if (line == null || line.length() == ) return "";
st = new StringTokenizer(line);
}
catch (IOException e)
{
return "";
//e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt()
{
return Integer.parseInt(next());
} long nextLong()
{
return Long.parseLong(next());
} double nextDouble()
{
return Double.parseDouble(next());
} String nextLine()
{
String str = "";
try
{
str = br.readLine();
}
catch (IOException e)
{
return "";
//e.printStackTrace();
}
return str;
}
}
}
1024程序员节!(JAVA Code)的更多相关文章
- 1024程序员节最新福利之2018最全H5前端资料集
前言 有好久没有写博客了,主要这段时间都沉迷学习无法自拔了,哈哈.自吹一波. 前两天不是1024节吗,所以就有很多福利出现了,当然每个人能都获得的信息都有所不同,这就是所谓的信息差.秉着好东西需要分享 ...
- Java语言编码规范(Java Code Conventions)
Java语言编码规范(Java Code Conventions) 名称 Java语言编码规范(Java Code Conventions) 译者 晨光(Morning) 简介 本文档讲述了Java语 ...
- java code to byte code--partone--reference
Understanding how Java code is compiled into byte code and executed on a Java Virtual Machine (JVM) ...
- [转]Java Code Examples for android.util.JsonReader
[转]Java Code Examples for android.util.JsonReader The following are top voted examples for showing h ...
- SQL to Java code for Elasticsearch
Elasticsearch虽然定位为Search Engine,但是因其可以持久化数据,很多时候,我们把Elasticsearch当成Database用,但是Elasticsearch不支持SQL,就 ...
- JUnit单元测试教程(翻译自Java Code Geeks)
JUnit单元测试教程--终极指南 JUnit单元测试教程终极指南 说明 单元测试简介 1 什么是单元测试 2 测试覆盖 3 Java中的单元测试 JUnit简介 1 使用Eclipse实现简单JUn ...
- Java Code Style
近期困惑于团队成员代码风格迥异,代码质量不可控,作为一名老司机,忧患于后期服务的可维护性,多次一对一的代码Review,耗时耗力不说,效果也不明显.痛定思痛,多次反思之后得出结论:无规矩不成方圆,可靠 ...
- 玩转Eclipse — 自动代码生成的Java Code Template
文章转载地址:点击打开链接 当代码写到一定程度之后,就会发现很多代码都被重复地敲了N多遍,甚至毫不夸张地说:闭着眼睛都能敲出来.大量地敲这些重复地代码,除了锻炼敲键盘的速度,基本上没有其他益处,但是长 ...
- 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 ...
- 【Android XML】Android XML 转 Java Code 系列之 介绍(1)
最近在公司做一个项目,需要把Android界面打包进jar包给客户使用.对绝大部分开发者来说,Android界面的布局以XML文件为主,并辅以少量Java代码进行动态调整.而打包进jar包的代码,意味 ...
随机推荐
- 【JZOJ3211】【SDOI2013】随机数生成器
╰( ̄▽ ̄)╭ 小 W喜欢读 书,尤其喜欢读 书,尤其喜欢读<约翰克里斯 朵夫>. 最近小 W准备读一本新书,这本一共有 p页, 页码范围为 0..p -1. 小 W很忙,所以每天只能读一 ...
- 【JZOJ4755】【NOIP2016提高A组模拟9.4】快速荷叶叶变换
题目描述 输入 一行,包含两个整数N,M. 输出 1个整数,FHT(N,M) mod 1000000007的值. 样例输入 3 4 样例输出 1 数据范围 对于 40% 的数据,1 ≤ N,M ≤ 1 ...
- Directx11教程(58) 鼠标控制摄像机
原文:Directx11教程(58) 鼠标控制摄像机 本篇教程我们实现鼠标旋转摄像机的操作.主要就是按下鼠标左键的时候,根据鼠标的移动对摄像机进行pitch, raw的组合旋转.具体修改 ...
- Java中的四种引用(强引用、软引用、弱引用、虚引用)
以下内容摘自<深入理解Java虚拟机 JVM高级特性与最佳实践>第2版,强烈推荐没有看过的同学阅读,读完的感觉就是"原来学的都是些什么瘠薄东西(╯‵□′)╯︵┴─┴" ...
- PHPCMS快速建站系列之常用标签
<span class="Nmore"><a href="/index.php?m=content&c=index&a=lists&am ...
- 关于element-ui的弹框问题
el-dialog获取数据. el-dialog加载到页面中的时候,其实已经加载好了.只是默认隐藏了. 第一次点击的时候弹出,为何拿不到数据?之后再次操作就一点问题都没有了.
- JAVA高级特性--内部类
内部类概念 public class Outer{ class inner{ } } 特点 可以很好的实现隐藏,可以使用procted,private 可以直接访问外部类的所有成员 ,包括私有成员. ...
- python 内置函数补充 or 递归 or 二分法
一.内置函数的补充 repr() 显示出字符串的官方表示形式 chr() print(chr(20013)) # 把数字编码转换成字符串 ord() print(ord('中')) # 20013 把 ...
- websocket实现数据库更新时前端页面实时刷新
websocket实现数据库更新时前端页面实时刷新 javaweb 目录(?)[+] userjsp ManagerServletjava 如题,实现以上功能,我知道主要有两大种思路: 轮询:轮询的原 ...
- E - D Tree HDU - 4812 点分治+逆元
这道题非常巧妙!!! 我们进行点分治的时候,算出当前子节点的所有子树中的节点,到当前节点节点的儿子节点的距离,如下图意思就是 当前节点的红色节点,我们要求出红色节点的儿子节点绿色节点,所有绿色的子树节 ...