A Simple Mean

View as PDF

Submit solution

Points: 7
Time limit: 0.2s
Assembly (ARM) 0.5s
Memory limit: 1M
Assembly (ARM) 4M

Author:
Problem type
Allowed languages
Assembly

Your computer engineering instructor gave you a simple task:

Write a program to find the integer mean of three integers A, B, C.

Since you think this is too easy a task for your programming prowess, you've decided to make life more interesting... by computing this simple mean in assembly.

Input Specification

The first line of input will contain 3 space-separated integers A, B, C (0 \le A, B, C \le 10).

Output Specification

The integer mean of the three integers.

Sample Input

1 2 4

Sample Output

2

Note

To use libc in NASM, the first line of your program should be ; libc. For all others, it should be ; features: libc.

Language Constraints

Because Assembly (ARM) runs under qemu, it is allocated 0.5s and 4096kb of RAM.


Comments


  • -2
    mhtilyas2  commented on Jan. 17, 2019, 3:51 p.m.

    For Help :

    PHP version : <?php $handle = fopen ("php://stdin","r"); $line = fgets($handle); $z = explode(' ',$line); $t = $z[0]+$z[1]+$z[2]; $t2 = $t/3; echo intval($t2); ?>


    • 1
      magicalsoup  commented on Jan. 17, 2019, 9:38 p.m.

      I don't think php is allowed......


  • -21
    yichunbshen  commented on Feb. 20, 2017, 6:54 p.m.

    This comment is hidden due to too much negative feedback. Click here to view it.


  • 2
    Jeffmagma  commented on Nov. 28, 2016, 1:21 p.m.

    For some reason, I'm getting a floating point exception when I try to divide, even though my numbers are correct. Does the div command work a different way than I think? The way I understand it, if I mov bl, 3 and div bl, it would divide ax by bl and store the quotient in al.