解题思路:
似乎是贪心?
参考代码:
import java.util.Scanner; public class Main1108 { //速度 和 魔法消耗 static int SPEND = 17; static int m = 10; public static void main(String[] args) { Scanner sc = new Scanner(System.in); //魔法初始值 int M = sc.nextInt(); //距离 int S = sc.nextInt(); //最终下降的时间 int T = sc.nextInt(); int flash = 0; int distance = 0; for (int i = 1; i <= T; i++) { if (M >= 10) { M -= m; flash += 60; } else { M += 4; } distance = Math.max(distance + SPEND, flash); if (distance >= S) { System.out.println("Yes"); System.out.print(i); return; } } System.out.println("No"); System.out.print(distance); } }
0.0分
1 人评分
C语言程序设计教程(第三版)课后习题6.3 (C语言代码)浏览:482 |
printf基础练习2 (有点不明白)浏览:845 |
淘淘的名单 (C语言代码)浏览:1104 |
小九九 (C语言描述,不看要求真坑爹)浏览:985 |
C语言程序设计教程(第三版)课后习题10.3 (C语言代码)浏览:509 |
C二级辅导-计负均正 (C语言代码)浏览:482 |
A+B for Input-Output Practice (II) (C语言代码)浏览:601 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:521 |
陶陶摘苹果2 (C++代码)浏览:550 |
【偶数求和】 (C语言代码)浏览:441 |