21785_ASimpleLanguage

2022-5-16 18:20| 发布者: Hocassian| 查看: 23| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-4-89505846273299-Problem List-采集的数据-后羿采集器.html

Pro.ID

21785

Title

A Simple Language

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=21785

AC

0

Submit

0

Ratio

-

时间&空间限制

  • Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 65536/32768 K (Java/Others)
  • 描述

    Professor X teaches the C Programming language in college, but he finds it's too hard for his students and only a few students can pass the exam. So, he decide to invent a new language to reduce the burden on students.

    This new language only support four data type, but the syntax is an strict subset of C. It only support assignment operation, brackets operation , addition , subtration, multiplication and division between variables and numbers. The priority of operations is the same as C.

    In order to void the problem of forgetting the eliminator ";", this new language allow to omit it.

    The variable naming rules is the same as C.

    Comments is not allowed in this language.

    Now Prof.X need to impelment this language, and the variable part is done by himself. Now Prof.X need you, a execllent ACM coder's help: Given a section of this language's code, please calculate it's return value.

    输入

    The input contains many lines, each line is a section of codes written in the language described above, you can assume that all variables have been declared as int and have been set to 0 initially.

    输出

    Description

    Professor X teaches the C Programming language in college, but he finds it's too hard for his students and only a few students can pass the exam. So, he decide to invent a new language to reduce the burden on students.

    This new language only support four data type, but the syntax is an strict subset of C. It only support assignment operation, brackets operation , addition , subtration, multiplication and division between variables and numbers. The priority of operations is the same as C.

    In order to void the problem of forgetting the eliminator ";", this new language allow to omit it.

    The variable naming rules is the same as C.

    Comments is not allowed in this language.

    Now Prof.X need to impelment this language, and the variable part is done by himself. Now Prof.X need you, a execllent ACM coder's help: Given a section of this language's code, please calculate it's return value.

    Input

    The input contains many lines, each line is a section of codes written in the language described above, you can assume that all variables have been declared as int and have been set to 0 initially.

    Output

    To each line of input, output an integer indicate the return value of the input line. the semicolon will only appear in the end of line, you can assume that every literal, variable's value and the intermediate results of calculation would never bigger than a short integer.

    Notice: the result may affect by assignment operation, if you don't know the exact return value of some statements such as a=3, you can try run codes such as ' printf("%d",a=3); ' in C, and check the result.

    Sample Input

    a=3
    a+b
    a=a*(b+2)+c;
    a+b
    a/4
    _hello=2*a;

    Sample Output

    3
    3
    6
    6
    1
    12

    Source

    样例输入

    a=3
    a+b
    a=a*(b+2)+c;
    a+b
    a/4
    _hello=2*a;

    样例输出

    3
    3
    6
    6
    1
    12

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部