4A. Watermelon

        One hot summer day Pete and his friend Billy decided to buy a watermelon. They chose the biggest and the ripest one, in their opinion. After that the watermelon was weighed, and the scales showed w kilos. They rushed home, dying of thirst, and decided to divide the berry, however they faced a hard problem.

        Pete and Billy are great fans of even numbers, that's why they want to divide the watermelon in such a way that each of the two parts weighs even number of kilos, at the same time it is not obligatory that the parts are equal. The boys are extremely tired and want to start their meal as soon as possible, that's why you should help them and find out, if they can divide the watermelon in the way they want. For sure, each of them should get a part of positive weight.

Input

The first (and the only) input line contains integer number w (1 ≤ w ≤ 100) — the weight of the watermelon bought by the boys.

Output

Print YES, if the boys can divide the watermelon into two parts, each of them weighing even number of kilos; and NO in the opposite case.

Examples

input

8

output

YES

 水题,两个人买西瓜,西瓜是否可以分成两半都是偶数(even number)

#include <iostream>

using namespace std;

int main()
{
	int w = 0;
	cin >> w;
	if(w / 2 > 1 && w % 2 == 0) cout<<"YES";
	else cout<<"NO"; 
	
	return 0;	
} 

### 使用 BufferedReader 实现逐行读取文本文件并统计字符数、单词数和行数 以下是一个完整的 Java 示例代码,展示如何使用 `BufferedReader` 逐行读取文件内容,并通过正则表达式分割单词以统计字符数、单词数和行数。 ```java import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; public class TextStatistics { public static void main(String[] args) { String filePath = "example.txt"; // 文件路径 int charCount = 0; // 字符计数 int wordCount = 0; // 单词计数 int lineCount = 0; // 行计数 try (BufferedReader br = new BufferedReader(new FileReader(filePath))) { String line; while ((line = br.readLine()) != null) { lineCount++; // 每读取一行,行数加一 charCount += line.length(); // 统计当前行的字符数 // 使用正则表达式匹配单词 String[] words = line.split("\\s+"); // 按照空白字符分割单词 wordCount += words.length; // 累加单词数量 } } catch (IOException e) { System.err.println("读取文件时发生错误: " + e.getMessage()); } System.out.println("字符数: " + charCount); System.out.println("单词数: " + wordCount); System.out.println("行数: " + lineCount); } } ``` #### 代码解析 1. **文件读取**:通过 `BufferedReader` 和 `FileReader` 读取文件内容。每次调用 `readLine()` 方法会返回文件中的一行[^1]。 2. **字符统计**:通过 `line.length()` 获取每行的字符数,并将其累加到 `charCount` 中。 3. **单词统计**:使用正则表达式 `\\s+` 分割字符串,将每行按空白字符(包括空格、制表符等)分割为单词数组[^2]。然后计算单词数组的长度并累加到 `wordCount`。 4. **行数统计**:每次成功读取一行后,行数计数器 `lineCount` 增加 1。 #### 注意事项 - 如果文件中包含空行,`line.split("\\s+")` 的结果将是空数组,因此不会对单词计数产生影响。 - 正则表达式 `\\s+` 匹配一个或多个空白字符,确保可以正确处理多空格的情况[^2]。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值