洛谷入门题P1000、P1001、P1421、P1425题解(Java语言描述)
生活随笔
收集整理的這篇文章主要介紹了
洛谷入门题P1000、P1001、P1421、P1425题解(Java语言描述)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
P1000題目要求
P1000題目鏈接
P1000題解
public class Main {public static void main(String[] args) {System.out.println(" ********\r\n" + " ************\r\n" + " ####....#.\r\n" + " #..###.....##....\r\n" + " ###.......###### ### ###\r\n" + " ........... #...# #...#\r\n" + " ##*####### #.#.# #.#.#\r\n" + " ####*******###### #.#.# #.#.#\r\n" + " ...#***.****.*###.... #...# #...#\r\n" + " ....**********##..... ### ###\r\n" + " ....**** *****....\r\n" + " #### ####\r\n" + " ###### ######\r\n" + "##############################################################\r\n" + "#...#......#.##...#......#.##...#......#.##------------------#\r\n" + "###########################################------------------#\r\n" + "#..#....#....##..#....#....##..#....#....#####################\r\n" + "########################################## #----------#\r\n" + "#.....#......##.....#......##.....#......# #----------#\r\n" + "########################################## #----------#\r\n" + "#.#..#....#..##.#..#....#..##.#..#....#..# #----------#\r\n" + "########################################## ############");}}P1001題目要求
P1001題目鏈接
P1001題解
import java.io.*; import java.util.*; public class Main {public static void main(String args[]) throws Exception {Scanner scanner=new Scanner(System.in);int a = scanner.nextInt(), b = scanner.nextInt();System.out.println(a+b);scanner.close();} }P1421題目要求
P1421題目鏈接
P1421題解
import java.util.Scanner;public class Main {public static void main(String args[]) throws Exception {Scanner scanner = new Scanner(System.in);int a = scanner.nextInt(), b = scanner.nextInt();if (a<=10000 && b<=9 && a>=0 && b>=0) {int c = (int) (a*10 + b)/19;System.out.println(c);}scanner.close(); } }P1425題目要求
P1425鏈接
P1425題解
import java.util.Scanner;public class Main {public static void main(String[] args) {Scanner scan = new Scanner(System.in);int a = scan.nextInt(), b = scan.nextInt(), c = scan.nextInt(), d = scan.nextInt();int e = c - a, f = d - b;if (f <= 0) {e--;f+=60;}System.out.println(e + " " + f);scan.close();}}總結
以上是生活随笔為你收集整理的洛谷入门题P1000、P1001、P1421、P1425题解(Java语言描述)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 单身汪的电梯之旅(洛谷P1897题题解,
- 下一篇: 使用AspectJ注解技术实现AOP功能