import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/*
街道和房屋
*/
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int []list = new int[15];
int []list1 = new int[7];//奇数
int []list2 = new int[8];//偶数
int sum1 = 0;//奇数和
int sum2 = 0;//偶数和
for (int i = 0;i < 15;i++) {
String s = br.readLine();
list[i] = Integer.parseInt(s);
for (int k = 0;k < 7;k++)
if(i % 2 !=0) {
list1[k] = list[i];
sum1+=list1[k];
}
for (int j = 0;j < 8;j++) {
if (i % 2 == 0) {
list2[j] = list[i];
sum2 += list2[j];
}
}//在此编写你的代码
}
if(sum1 > sum2) {
System.out.println("居住在门牌号为奇数的房屋的居民更多。");
} else if (sum1 < sum2){
System.out.println("居住在门牌号为偶数的房屋的居民更多。");
}
}
}
package zh.codegym.task.task07.task0706;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/*
街道和房屋
*/
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int []list = new int[15];
int []list1 = new int[7];
int []list2 = new int[8];
int sum1 = 0;
int sum2 = 0;
for (int i = 0;i < 15;i++) {
String s = br.readLine();
list[i] = Integer.parseInt(s);
for (int k = 0;k < 7;k++)
if(i % 2 !=0) {
list1[k] = list[i];
sum1+=list1[k];
}
for (int j = 0;j < 8;j++) {
if (i % 2 == 0) {
list2[j] = list[i];
sum2 += list2[j];
}
}//在此编写你的代码
}
if(sum1 > sum2) {
System.out.println("居住在门牌号为奇数的房屋的居民更多。");
}else if (sum1 < sum2) {
System.out.println("居住在门牌号为偶数的房屋的居民更多。");
}
}
}