农场兔子喝水

2023-11-21 02:50
文章标签 喝水 兔子 农场

本文主要是介绍农场兔子喝水,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

 农场主由中间开始浇N次水。格子低兔子先喝到水。求没有喝到、喝到1~2次,大于2次水的兔子数量。

public class 农场里饲养了N只兔子 {private static int[][] rabbit;private static int time;public static void main(String[] args) {Scanner scanner = new Scanner(System.in);int n = scanner.nextInt();rabbit = new int[n][2];for (int i = 0; i < n; i++) {int high = scanner.nextInt();rabbit[i][0] = high;}time = scanner.nextInt();int start = scanner.nextInt();water(start);int a = 0;int b = 0;int c = 0;for (int[] rab : rabbit) {if (rab[1] == 0) {a++;} else if (rab[1] > 2) {c++;} else {b++;

这篇关于农场兔子喝水的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/399312

相关文章

兔子--Notification的使用

<span style="font-size:18px;color:#ff0000;"></span> <span style="font-size:18px;color:#ff0000;">使用步骤:</span><p><span style="font-size:18px;color:#ff0000;">1 获取通知管理器NotificationManager,它也是一个系统服务</sp

兔子--PendingIntent与Intent的区别

pendingIntent是一种特殊的Intent。 主要的区别在于Intent的执行立刻的,而pendingIntent的执行不是立刻的。 pendingIntent执行的操作实质上是参数传进来的Intent的操作, 但是使用pendingIntent的目的在于它所包含的Intent的操作的执行是需要满足某些条件的。 主要的使用的地方和例子:通知Notificatio

兔子--The method setLatestEventInfo(Context, CharSequence, CharSequence, PendingIntent) from the type

notification.setLatestEventInfo(context, title, message, pendingIntent);     不建议使用 低于API Level 11版本,也就是Android 2.3.3以下的系统中,setLatestEventInfo()函数是唯一的实现方法。  Intent  intent = new Intent(

兔子--背景透明度设置

背景透明度设置:ee是透明度 android:background="#ee6c6c6c"

兔子--Android Support v4,Android Support v7,Android Support v13

Android Support Library package用于高版本的特性的向下兼容。 (fragement,ViewPager) Android Support v4:  这个包是为了照顾1.6及更高版本而设计的,这个包是使用最广泛的,eclipse新建工程时,都默认 带有了。 Android Support v7:  这个包是为了考虑照顾2.1及以上版本而设计的,

兔子--Android Support v4包丢失的解决办法

在开发中,Android Support v4包丢失的解决办法: Project->properties->Java Build Path->Libraries->Add External Jars 中加入sdk目录下的extras/android/support/v4/android-support-v4.jar (如果找不到,则需要用sdk manager下载andro

兔子--SDK,ADT,AVD,IDE,ADB

a:SDK(Software Development Kit):开发android应用所需要的开发工具的集合,包括库文件及工具。 b:ADT(Android Developer Tools):在Eclipse下开发工具的升级下载工具。adt只是一个eclipse的插件,里面可以设置 sdk路径. c:IDE:集成开发环境。IDE通常包括编程语言编辑器、自动建立工具、通常还包括调试

兔子--eclipse下载插件

eclipse菜单栏->help->adout ADT->Installation Details->找到要卸载的插件->选中->点击下方uninstall

兔子--eclipse设置编码格式

设置编码格式 a:设置eclipse的默认编码格式:window->preferences->Workspace->Text File Encoding b:设置单个项目的编码格式::右键项目——Properties——Resource——Text file encoding