java解题-杭电水题100道
bruce_suxin
坚持就是胜利
展开
-
杭电 2035 ( 人见人爱A^B ) java
import java.util.Scanner;import java.math.BigInteger;public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) {原创 2017-01-24 17:00:14 · 478 阅读 · 0 评论 -
杭电 2019 ( 数列有序! ) C
#includevoid main(){ int n,m,a[101],i; while(scanf("%d%d",&n,&m)!=EOF && (n||m)){ for(i=0;i<n;i++) scanf("%d",&a[i]); for(i=0;i<n;i++) if(m>a[i])原创 2017-01-24 16:36:31 · 694 阅读 · 0 评论 -
杭电 2018 ( 母牛的故事 ) java
斐波那契变形import java.util.*;public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { int n = sc.ne原创 2017-01-24 16:34:33 · 371 阅读 · 0 评论 -
杭电 2017 ( 字符串统计 ) java
import java.util.*;public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(sc.hasNext()){ int n = sc.nextInt(); f原创 2017-01-23 21:00:46 · 526 阅读 · 0 评论 -
杭电 2016 ( 数据的交换输出 ) java
import java.util.Scanner; import java.util.Arrays; public class Main { public static void main(String[] args) { Scanner k = new Scanner(System.in); while(k.hasNext()){原创 2017-01-23 16:40:32 · 446 阅读 · 0 评论 -
杭电 2015 ( 偶数求和 ) java
import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(sc.hasNext()){ int n=sc.nextInt();原创 2017-01-23 15:29:41 · 331 阅读 · 0 评论 -
杭电 2014 ( 青年歌手大奖赛_评委会打分 ) java
import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { int num = sc.nextIn原创 2017-01-23 15:16:54 · 472 阅读 · 0 评论 -
杭电 2013 ( 蟠桃记 ) java
import java.util.Scanner; public class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { int tao = 1;原创 2017-01-23 15:13:56 · 559 阅读 · 0 评论 -
杭电 2012 ( 素数判定 ) java
import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { int x = sc.nextInt(原创 2017-01-23 15:10:28 · 457 阅读 · 0 评论 -
杭电 2011 ( 多项式求和 ) java
import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { int num = sc.nextIn原创 2017-01-23 15:08:23 · 491 阅读 · 0 评论 -
杭电2010 ( 水仙花数 ) java
import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int i, j, n, m, a, b, c; while (sc.hasNextInt(原创 2017-01-23 15:05:08 · 350 阅读 · 0 评论 -
杭电 2009 ( 求数列的和 ) java
import java.util.Scanner;import java.text.DecimalFormat;public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); while(sc.hasNex原创 2017-01-23 15:02:45 · 403 阅读 · 0 评论 -
杭电 2008 ( 数值统计 ) java
import java.util.Scanner;public class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { int n=sc.nextInt();原创 2017-01-23 14:59:26 · 303 阅读 · 0 评论 -
杭电 2020 ( 绝对值排序 ) java
import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { int n = sc.nextInt(原创 2017-01-24 16:38:09 · 445 阅读 · 0 评论 -
杭电 2021 ( 发工资咯:) java
import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { int n = sc.nextInt(原创 2017-01-24 16:39:42 · 453 阅读 · 0 评论 -
杭电 2022 ( 海选女主角 ) java
import java.util.*;public class Main{ static int abss(int a) { return a > 0 ? a : (-a); } public static void main(String args[]) { Scanner cin = new Scanner(System.in);原创 2017-01-24 16:41:36 · 290 阅读 · 0 评论 -
杭电 2034 ( 人见人爱A-B ) java
import java.util.ArrayList;import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(sc.hasNext()){原创 2017-01-24 16:58:58 · 346 阅读 · 0 评论 -
杭电 2033 ( 人见人爱A+B ) java
import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int h = 0; int m原创 2017-01-24 16:57:44 · 644 阅读 · 0 评论 -
杭电 2032 ( 杨辉三角 ) java
import java.util.*;public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { int n = sc.nextInt();原创 2017-01-24 16:56:12 · 318 阅读 · 0 评论 -
杭电 2031 ( 进制转换 ) java
import java.util.*;public class Main { public static void main(String args[]){ Scanner cin=new Scanner(System.in); while(cin.hasNext()){ int n=cin.nextInt();//十进制数n原创 2017-01-24 16:54:48 · 408 阅读 · 0 评论 -
杭电 2030 ( 汉字统计 ) java
import java.util.*;public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { int n = sc.nextInt();原创 2017-01-24 16:53:24 · 593 阅读 · 0 评论 -
杭电 2029 ( Palindromes _easy version ) java
import java.util.*;public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { int n = sc.nextInt();原创 2017-01-24 16:52:16 · 402 阅读 · 0 评论 -
杭电 2028 ( Lowest Common Multiple Plus ) java
import java.util.*;public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { int n = sc.nextInt();原创 2017-01-24 16:51:07 · 324 阅读 · 0 评论 -
杭电 2027 ( 统计元音 ) java
import java.util.*;public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { int n = sc.nextInt();原创 2017-01-24 16:49:20 · 409 阅读 · 0 评论 -
杭电 2026 ( 首字母变大写 ) java
import java.util.*;public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { String str = sc.nextLine(原创 2017-01-24 16:48:16 · 344 阅读 · 0 评论 -
杭电 2025 ( 查找最大元素 ) java
import java.util.*;public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { String str = sc.next();原创 2017-01-24 16:46:53 · 429 阅读 · 0 评论 -
杭电 2024 ( C语言合法标识符 ) java
import java.util.*;public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { int n = sc.nextInt();原创 2017-01-24 16:44:51 · 467 阅读 · 1 评论 -
杭电 2023 ( 求平均成绩 ) java
import java.util.*;public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { int n = sc.nextInt();原创 2017-01-24 16:43:07 · 613 阅读 · 1 评论 -
杭电 2007 ( 平方和与立方和 ) java
import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); while(sc.hasNext()){ int x=0; int y=0;原创 2017-01-23 14:57:16 · 529 阅读 · 0 评论 -
杭电 2006 ( 求奇数的乘积 ) java
import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); while(sc.hasNext()) {原创 2017-01-23 14:55:02 · 449 阅读 · 0 评论 -
杭电2521 反素数
import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n=sc.nextInt(); while (n-->0) {原创 2016-12-22 20:45:40 · 285 阅读 · 0 评论 -
杭电2504 又见GCD
import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { int inputtimes = s原创 2016-12-22 20:43:26 · 347 阅读 · 0 评论 -
杭电2500 做一个正气的杭电人
import java.util.*;public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); int n, m; n = input.nextInt(); for (int i原创 2016-12-22 20:39:39 · 363 阅读 · 0 评论 -
杭电2548 两军交锋
中学物理题import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt();原创 2016-12-22 20:37:25 · 409 阅读 · 0 评论 -
杭电2053 Switch Game
题意:有无限多的电灯排成一列,一开始都是关,操作无限多次,第i次操作会把编号为i和i的倍数的电灯改变状态 问最后第i盏电灯的状态是开还是关。import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner sc = new Sc翻译 2016-12-22 20:34:14 · 350 阅读 · 0 评论 -
杭电第1865题 1sting
题目1sting 杭电第1865题:找规律题 这里翻译一下: 你将得到一个字符串这个字符串里面的内容为仅为'1';你可以合并1把它变成'2'或者是不变也就是'1' 显然,你就可以得到多种不同的结果。例如,给出一个字符串为'1111',你可以得到的结果为: 1111, 121 , 112 ,211 ,22。现在你的工作就是寻找这个字符串在满足条件下的所有可能种数。 输入翻译 2016-12-22 20:30:48 · 353 阅读 · 0 评论 -
杭电1297 Children’s Queue
我对此题进行大致的翻译: PHT学校有许多学生。有一天,校长,他的名字叫PigHeader希望所有学生站在一条线。他规定,女孩不能在单独一个人站着 换句话说,队列中要么全都是男孩,要么女孩不只有一个并肩站着,例如当n=4(表示孩子的数量)有如下排列方式 FFFF, FFFM, MFFF, FFMM, MFFM, MMFF, MMMM 这里的F表示女孩,M表示男孩,队列的排列方式总数翻译 2016-12-22 20:28:09 · 566 阅读 · 0 评论 -
杭电2013蟠桃记
import java.util.Scanner;public class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { int tao = 1;原创 2016-12-22 20:24:47 · 314 阅读 · 0 评论 -
杭电2091空心三角形
import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner re = new Scanner(System.in); char a; char aa; int n = 0, b = 0, c原创 2016-12-22 20:21:51 · 461 阅读 · 0 评论 -
杭电2041超级楼梯
import java.util.*;public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { int c = sc.nextInt();原创 2016-12-22 20:19:51 · 402 阅读 · 0 评论