21.计算机内存

32 阅读1分钟

链接:ac.nowcoder.com/acm/problem…
来源:牛客网

题目描述

我们可以看到题目描述的上方有一个空间限制32M, 在计算机中一个整数占据4个字节的内存, 1MB等于1024KB, 1KB等于1024B, 1B就代表1字节, 那么请问n MB的内存可以使用多少个整数呢?

输入描述:

输入一个整数n,表示内存大小(MB) 1<=n<=256

输出描述:

输出一个整数

示例1

输入

1

输出

262144

代码

#include <bits/stdc++.h>

using namespace std;

int main(){
    int MB;
    cin >> MB;
    int bit = MB * 262144;
    cout << bit;
    return 0;
}