REPEAT program

Question E: Blue Bridge Cup 2020javac group REPEAT program
Total score: 15 points

【Problem Description】

The attached prog.txt is a program written in a certain language.

Among them, REPEAT k represents a cycle of number k. The range of loop control is expressed by indentation,

From the next line, the continuous indentation more than this line (the previous blank is longer) is the content contained in the loop.

For example, the following fragment:

Insert picture description here
Insert picture description here

In this fragment, the line from A = A + 4 to the line A = A + 8 is in the first line of the loop twice.

REPEAT 6: The line where A = A + 7 is in the REPEAT 5: loop.

A = A + 5 The actual total number of cycles is 2 × 5 × 6 = 60 times.

After the program is executed, what is the value of A?

[Answer submitted]

This is a fill-in-the-blank question, you only need to calculate the result and submit it. The result of this question is one

Integer, only fill in this integer when submitting the answer, fill in the extra content will not be scored
The answer is: 403

import java.util.Scanner;

public class Main {
    
    
public static void main(String[] args) {
    
    
	int A=0;
	for(int i=0;i<2;i++) {
    
    
		A=A+4;
		for(int j=0;j<5;j++) {
    
    
			for(int z=0;z<6;z++) {
    
    
				A=A+5;
			}
			A=A+7;
		}
		A=A+8;
	}
	A=A+9;
	System.out.println(A);
}
}

Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_45952706/article/details/109015801