12.4 Your brain capacity

Your brain capacity

Description

int 4 bytes, bool occupies one byte, long long occupies 88 bytes, double 8 bytes, char takes 1 byte, float 4 bytes.
This is the mantra which world line do? A variety of computer storage capacity units are in bytes (Byte simple as BB) are represented, in addition to KB (kilobytes), MB (megabytes), GB (gigabytes) and TB (too bytes), their relationship is to
Here Insert Picture Description
ask you to write a program, find n number of six types of variables, those variables determined how many KB (kilobytes) of memory theoretically requires the use of, the answer is rounded up.

Input

A first line integer T, T representatives set of sample
for each sample of the first n rows and n identifies the inputted row (n <= 100000) as shown in the above n-th row next
input guaranteed
1: Only one row for each type and variable names exist: INTA; not exist: INTA, B
2: basic input format is: <variable type> <variable name>
. 3: n-and not more than 200,000

Output

The number of output KB (kilobytes) of memory (rounded up)

Sample Input 1

1
1

int a

Sample Output 1
1


WA five water problem
because I loop mess
cause emmmm
to paste the code, a summary will come after reading the book

#include<stdio.h>
#include<math.h>
#include<string.h>
int main()
{
    int T,n;
    double i,j;
    char x;
    scanf("%d",&T);
    while(T--)
    {
        int sum=0;
        scanf("%d",&n);
        while(n--)
        {
            char a[10];
            scanf("%s",&a);
            getchar();
            x=a[0];
            gets(a);
            if(x=='i'||x=='f') sum+=4;
            else if(x=='b'||x=='c') sum+=1;
            else if(x=='l'||x=='d') sum+=8;
            i=sum%1024;
            j=sum/1024;
        }
        if(i!=0) printf("%.0lf\n",j+1);
        else printf("%.0lf\n",j);
    }
    return 0;
}

to sum up

Questions like this. Duck T set of data, the data n number of groups each duck. . .
The Universal this type:

scanf("%d",&T);
while(T--)

Note that this problem then, is the result of the input of each T,
so to sum = 0, should be placed

scanf("%d",&n);

Front.


Leaving a tail: see vertical multiplication multiply and divide and conquer. over

Guess you like

Origin blog.csdn.net/qq_42906486/article/details/84798984