<>第十一届蓝桥杯大赛软件类省赛

<>C/C++大学B组

<>试题

public class Main { public static void main(String[] args) { int tot = 10000;
boolean go = true; int ans = 0; while(true && tot >= 0) { if(go) { if(tot - 600
< 0) break; tot -= 600; go = false; } else { tot += 300; go = true; } ans ++; }
System.out.println(ans * 60 + tot / 10); } }

import java.util.Date; import java.text.SimpleDateFormat; import java.text.
ParseException; public class Main { public static void main(String[] args)
throws ParseException{ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd
HH:mm:ss"); Date begin = sdf.parse("1921-7-23 12:00:00"); Date end = sdf.parse(
"2020-7-1 12:00:00"); // getTime() returns a long number of milliseconds long
ans= end.getTime() - begin.getTime(); ans /= 60000; System.out.println(ans); } }

import java.util.Scanner; public class Main { public static void main(String[]
args) { Scanner in = new Scanner(System.in); long n; n = in.nextLong(); System.
out.print(n); while(n > 1) { n >>= 1; System.out.print(" " + n); } } }

import java.util.Scanner; public class Main { public static void main(String[]
args) { Scanner in = new Scanner(System.in); String s = in.nextLine(); char[] a
= s.toCharArray(); StringBuilder ans = new StringBuilder(); for(int i = 1; i < a
.length; i ++) { if(a[i] >= '2' && a[i] <= '9') { for(int j = 0; j < a[i] - '0';
j++) { ans.append(a[i - 1]); } } else if(a[i - 1] < '2' || a[i - 1] > '9') {
ans.append(a[i - 1]); } } if(a.length == 1) ans.append(a[0]); System.out.println
(ans.toString()); } }

import java.util.Scanner; public class Main { public static void main(String[]
args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int m = in.
nextInt(); int[][] dp = new int[n + 5][m + 5]; dp[1][1] = 1; for(int i = 1; i <=
n; i ++) { for(int j = 1; j <= m; j ++) { if((i & 1) == 1 || (j & 1) == 1) { dp
[i][j] += dp[i][j - 1] + dp[i - 1][j]; } } } System.out.println(dp[n][m]); } }

GitHub

Gitee